Here you can find the source of generateSalt(int length)
public static byte[] generateSalt(int length)
//package com.java2s; //License from project: Open Source License import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; public class Main { public static byte[] generateSalt(int length) { byte[] salt = new byte[length]; SecureRandom rnd = null;/*from w w w . ja v a 2 s . c o m*/ try { rnd = SecureRandom.getInstanceStrong(); } catch (NoSuchAlgorithmException e) { rnd = new SecureRandom(); } rnd.nextBytes(salt); return salt; } }