code: public void solve() {
          while (true) {
              try {
                  // Is our proof of work valid yet?
                  if (checkProofOfWork(false))
                      return;
                  // No, so increment the nonce and try again.
                  setNonce(getNonce() + 1);
              } catch (VerificationException e) {
                  throw new RuntimeException(e); // Cannot happen.
              }
          }
      }
docs: <p>Finds a value of nonce that makes the blocks hash lower than the difficulty target. This is called mining, but
  solve() is far too slow to do real mining with. It exists only for unit testing purposes.
  
  <p>This can loop forever if a solution cannot be found solely by incrementing nonce. It doesn't change
  extraNonce.</p>