Java API Tutorial - Java SecureRandom.getAlgorithm()








Syntax

SecureRandom.getAlgorithm() has the following syntax.

public String getAlgorithm()

Example

In the following code shows how to use SecureRandom.getAlgorithm() method.

//from  ww  w  . j a  v  a  2 s .  c  o m
import java.security.SecureRandom;

public class Main {
  public static void main(String[] argv) throws Exception {
    SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");


    System.out.println(sr.getAlgorithm());
  }
}

The code above generates the following result.