VOOZH about

URL: https://www.geeksforgeeks.org/java/securerandom-getalgorithm-method-in-java-with-examples/

⇱ SecureRandom getAlgorithm() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

SecureRandom getAlgorithm() method in Java with Examples

Last Updated : 6 Jun, 2021

The getAlgorithm() method of java.security.SecureRandom class is used to return the name of the algorithm implemented by this SecureRandom object.
Syntax: 
 

public String getAlgorithm()


Return Value: This method returns the name of the algorithm or unknown if the algorithm name cannot be determined.
Below are the examples to illustrate the getAlgorithm() method:
Example 1: 
 


Output: 
Algorithm: SHA1PRNG

 

Example 2: 
 


Output: 
Exception thrown : java.security.NoSuchAlgorithmException: TAJMAHAL SecureRandom not available

 
Comment