public void mineBlock(Block b) {
   for (int nonce = Integer.MIN_VALUE; nonce <= Integer.MAX_VALUE; ++nonce) {
     b.setNonce(nonce);
     b.computeHash();
     BigInteger hashAsInteger = new Hash(b.getHash()).toBigInteger();
     if (hashAsInteger.compareTo(Difficulty.getTarget(b.getDifficultyTarget())) <= 0) {
       break;
     }
   }
 }