title: How to return Enum if matches with given String
body: <p>I have Enum class as given below </p>
  
  <pre><code>public enum AlgorithmEnum {
  
      SHA512("RSA", "SHA512", 1), SHA1("RSA", "SHA1", 1), SHA384("RSA", "SHA384", 1);
  
      private String keyAlgorithm;
      private String hashAlgorithm;
      private Integer key;
  
      private AlgorithmEnum(String keyAlgorithm, String hashAlgorithm, Integer key) {
          this.keyAlgorithm = keyAlgorithm;
          this.hashAlgorithm = hashAlgorithm;
          this.key = key;
      }
  
      public String getKeyAlgorithm() {
          return keyAlgorithm;
      }
  
      public void setKeyAlgorithm(String keyAlgorithm) {
          this.keyAlgorithm = keyAlgorithm;
      }
  
      public String getHashAlgorithm() {
          return hashAlgorithm;
      }
  
      public void setHashAlgorithm(String hashAlgorithm) {
          this.hashAlgorithm = hashAlgorithm;
      }
  
      public Integer getKey() {
          return key;
      }
  
      public void setKey(Integer key) {
          this.key = key;
      }
  }
  </code></pre>
  
  <p>I need to have method something like below which takes input as string and returns Enum</p>
  
  <pre><code>public AlgorithmEnum getAlgorithm(String algorithm){
          //returns AlgorithmEnum object
      }
  </code></pre>
  
  <p>I would call above method by passing "SHA512withRSA" as input for getAlgorithm method.</p>
  
  <p>I need help in implementing the getAlgorithm method.</p>