private static String createBcryptString(byte[] password,byte[] salt,int cost){
  StringBuffer sb=new StringBuffer(60);
  sb.append('$');
  sb.append(version);
  sb.append('$');
  sb.append(cost < 10 ? ("0" + cost) : Integer.toString(cost));
  sb.append('$');
  sb.append(encodeData(salt));
  byte[] key=BCrypt.generate(password,salt,cost);
  sb.append(encodeData(key));
  return sb.toString();
}

private static String createBcryptString ( byte [ ] password , byte [ ] salt , int cost ) { StringBuffer sb = new StringBuffer ( 60 ) ; sb . append ( '$' ) ; sb . append ( version ) ; sb . append ( '$' ) ; sb . append ( cost < 10 ? ( "0" + cost ) : Integer . toString ( cost ) ) ; sb . append ( '$' ) ; sb . append ( encodeData ( salt ) ) ; byte [ ] key = BCrypt . generate ( password , salt , cost ) ; sb . append ( encodeData ( key ) ) ; return sb . toString ( ) ; }
creates a 60 character bcrypt string , including version , cost factor , salt and hash , separated by ' $ '
