Here you can find the source of generateSalt()
public static byte[] generateSalt()
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.security.SecureRandom; public class Main { public static byte[] generateSalt() { SecureRandom random = new SecureRandom(); byte salt[] = new byte[32]; random.nextBytes(salt);/* w w w . ja v a 2 s.c o m*/ return salt; } }