code: public static boolean shouldRehash(final char[] bcryptHash) {
          int rounds;
          if (bcryptHash.length < 59) {
              return true;
          }
          final StringBuilder sb = new StringBuilder();
          sb.append(bcryptHash[4]);
          if (bcryptHash[5] != '$') {
              sb.append(bcryptHash[5]);
          }
          rounds = Integer.valueOf(sb.toString());
          return rounds < ROUNDS;
      }
docs: Checks the asserted BCrypt formatted hashed password and determines if the password should
  be rehashed or not. If the BCrypt work factor is increased (from 12 to 14 for example),
  passwords should be evaluated and if the existing stored hash uses a work factor less than
  what is configured, then the bcryptHash should be rehashed. The same does not apply in
  reverse. Stored hashed passwords with a work factor greater than the configured work factor
  will return false, meaning they should not be rehashed.
  
  If the bcryptHash length is less than the minimum length of a BCrypt hash, this method
  will return true.
  
  @param bcryptHash the hashed BCrypt to check
  @return true if the password should be rehashed, false if not
  @since 1.0.0