Here you can find the source of generateSalt()
public static String generateSalt()
//package com.java2s; //License from project: Open Source License import java.security.SecureRandom; public class Main { private static final SecureRandom rand = new SecureRandom(); private static final String saltChars = "ABCDEFGHIJGMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-_=+[]{};:.,<>/?\\|~`"; public static String generateSalt() { return generateSalt(rand.nextInt(10) + 5); }//w w w. j av a 2 s. com public static String generateSalt(int length) { char[] array = new char[length]; for (int i = 0; i < length; i++) { array[i] = saltChars.charAt(rand.nextInt(saltChars.length())); } return new String(array); } }