### Question:
BCrypt { @Nonnull public static String gensalt (@Nonnegative final int nLogRounds, @Nonnull final SecureRandom aRandom) { final StringBuilder rs = new StringBuilder (); final byte [] rnd = new byte [BCRYPT_SALT_LEN]; aRandom.nextBytes (rnd); rs.append ("$2a$"); if (nLogRounds < 10) rs.append ('0'); else if (nLogRounds > 30) throw new IllegalArgumentException ("log_rounds exceeds maximum (30)"); rs.append (Integer.toString (nLogRounds)); rs.append ('$'); rs.append (_encode_base64 (rnd, rnd.length)); return rs.toString (); }  @Nonnull byte [] crypt_raw(final byte [] password, final byte [] salt, final int nLogRounds, final int [] cdata); @Nonnull static String hashpw(@Nonnull final String sPassword, @Nonnull final String sSalt); @Nonnull static String gensalt(@Nonnegative final int nLogRounds, @Nonnull final SecureRandom aRandom); @Nonnull static String gensalt(@Nonnegative final int log_rounds); @Nonnull static String gensalt(); static boolean checkpw(@Nonnull final String sPlaintext, @Nonnull final String sHashed); static final int GENSALT_DEFAULT_LOG2_ROUNDS; static final int BCRYPT_SALT_LEN; }### Answer:
@Test public void testGensalt () { LOGGER.info ("BCrypt.gensalt(): "); for (int i = 0; i < test_vectors.length; i += 4) { final String plain = test_vectors[i][0]; final String salt = BCrypt.gensalt (); final String hashed1 = BCrypt.hashpw (plain, salt); final String hashed2 = BCrypt.hashpw (plain, hashed1); assertEquals (hashed1, hashed2); LOGGER.info ("."); } LOGGER.info (""); }