title: Java: how to get the abs value of a short and keep it short
body: <pre><code>Short s = somevalue; // could be negative or positive
  myobject.setMyShort(Math.abs(s));
  </code></pre>
  
  <p>I can't change the type of field myShort of MyObject, at the same time Math.abs return only int values.
  Is it right to cast this way or could it result in a change of the original value?</p>
  
  <pre><code>myobject.setMyShort((short) Math.abs(s));
  </code></pre>