title: Cant convert enum type to short and vice versa
body: <p>In one class I have this code</p>
  
  <pre><code>public class RPCMessage implements Serializable{
   public static final short REQUEST = 0;
   public static final short REPLY = 1;
   public enum MessageType{REQUEST, REPLY};
   private MessageType messageType;
  
   public MessageType getMessageType() {
       return messageType;
   }
   public void setMessageType(MessageType messageType) {
       this.messageType = messageType;
   }
  }
  </code></pre>
  
  <p>I another class I try to access it but it gives me error there.
  Error Code: </p>
  
  <pre><code>int buffSize = c.lenInBytes();
          ByteBuffer bb = ByteBuffer.allocate(buffSize);
          short typeNum = (short) c.getMessageType();
          int index = 0;
          bb.putShort(0,typeNum);
          index+=2;
  </code></pre>
  
  <p>Also error in setting the same attribute</p>
  
  <pre><code>RPCMessage c = new RPCMessage();
                ByteBuffer bb = ByteBuffer.wrap(mData);
                int index = 0;
  
                c.setMessageType(bb.getShort(index));
                index += 2;
  </code></pre>
  
  <p>I am quite new to Java programming. Please help me out with this. Thanks in advance :)</p>