title: get enum name from enum value
body: <p>I've read a lot about how obtain the corresponding name of an <code>enum</code> from its value using java, but no example seems to work for me! What is wrong?</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>public class Extensions {
  
  
      public enum RelationActiveEnum
      {
          Invited(0),
          Active(1),
          Suspended(2);
  
          private final int value;
  
          private RelationActiveEnum(final int value) {
              this.value = value;
          }
      }
  </code></pre>
  
  <p>}</p>
  
  <p>and in another class I use:</p>
  
  <pre class="lang-java prettyprint-override"><code>        int dbValue = supp.ACTIVE;
          Extensions.RelationActiveEnum enumValue(dbValue);
          String stringName = enumValue.toString(); //Visible
          // OR
          int dbValuee = supp.ACTIVE;
          String stringValue = Enum.GetName(typeof(RelationActiveEnum), dbValue);
  </code></pre>
  
  <p>I should work, right? but it doesn't!!!! it tells me that dbValue cannote be cast to RelationActiveEnum...</p>