Here you can find the source of generateSalt()
public static String generateSalt()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { /**/*from w w w .j ava 2s.com*/ * Return a randomly-generated 16 character alphanumeric value * (a-z, A-Z, 0-9) * * @return String salt */ public static String generateSalt() { String validChars = "abcdefghijlmnopqrstuvwxyzABCDEFGHIKJLMNOPQRSTUVWXYZ0123456789"; int length = 16; Random rand = new Random(); StringBuilder sb = new StringBuilder(length); while (sb.length() != length) sb.append(validChars.charAt(rand.nextInt(validChars.length()))); return sb.toString(); } }