Java Signature getAlgorithm() method with Examples Last Updated : 06 Jun, 2021 Comments Improve Suggest changes Like Article Like Report The getAlgorithm() method of java.security.Signature class is used to return the name of the algorithm for this signature object.Syntax: public final String getAlgorithm() Return Value: This method returns the name of the algorithm for this signature object.Below are the examples to illustrate the getAlgorithm() method:Example 1: Java // Java program to demonstrate // getAlgorithm() method import java.security.*; import java.util.*; public class GFG1 { public static void main(String[] argv) { try { // creating the object of Signature Signature sr = Signature.getInstance("SHA1withDSA"); // getting the Algorithm // by using method getAlgorithm() String algo = sr.getAlgorithm(); // printing the string algo System.out.println("Algorithm: " + algo); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } } } Output: Algorithm: SHA1withDSA Example 2: Java // Java program to demonstrate // getAlgorithm() method import java.security.*; import java.util.*; public class GFG1 { public static void main(String[] argv) { try { // creating the object of Signature Signature sr = Signature.getInstance("NONEwithDSA"); // getting the Algorithm // by using method getAlgorithm() String algo = sr.getAlgorithm(); // printing the string algo System.out.println("Algorithm: " + algo); } catch (NoSuchAlgorithmException e) { System.out.println("Exception thrown : " + e); } } } Output: Algorithm: NONEwithDSA Comment More infoAdvertise with us Next Article Java Signature getAlgorithm() method with Examples rohitprasad3 Follow Improve Article Tags : Misc Java Java-Functions Java-security package Java-Signature +1 More Practice Tags : JavaMisc Similar Reads Java Signature getInstance() method with Examples getInstance(String algorithm) The getInstance() method of java.security.Provider class is used to return a Signature object that implements the specified signature algorithm. This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Signature o 5 min read SecureRandom getAlgorithm() method in Java with Examples 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.Bel 2 min read Provider.Service getAlgorithm() method in Java with Examples The getAlgorithm() method of java.security.Provider.Service class is used to return the standard name of the algorithm this Provider.Service is associated with. Syntax: public final String getAlgorithm() Return Value: This method returns name of the algorithm. Below are the examples to illustrate th 2 min read MessageDigest getAlgorithm() method in Java with Examples The method getAlgorithm() of java.security.MessageDigest class is used to return the standard name of the algorithm this message digest is associated with. Syntax: public final String getAlgorithm() Return Value: This method returns the algorithm used in message digest. Below are the examples to ill 2 min read Optional get() method in Java with examples The get() method of java.util.Optional class in Java is used to get the value of this Optional instance. If there is no value present in this Optional instance, then this method throws NullPointerException. Syntax: public T get() Parameters: This method do not accept any parameter. Return value: Thi 2 min read Like