code: public static String gensalt(int log_rounds, SecureRandom random) {
          StringBuilder rs = new StringBuilder();
          byte rnd[] = new byte[BCRYPT_SALT_LEN];
  
          random.nextBytes(rnd);
  
          rs.append("$2a$");
          if (log_rounds < 10) {
              rs.append("0");
          }
          rs.append(Integer.toString(log_rounds));
          rs.append("$");
          rs.append(encode_base64(rnd, rnd.length));
          return rs.toString();
      }
docs: Generate a salt for use with the BCrypt.hashpw() method
  @param log_rounds	the log2 of the number of rounds of
  hashing to apply - the work factor therefore increases as
  2**log_rounds.
  @param random		an instance of SecureRandom to use
  @return	an encoded salt value