title: Saving last 4 characters of a string in android
body: <p>Simple one this morning, but causing me issues and can't seem to find any code out there. I have created a hex representation of a number, and wish to now save the last 4 characters of the hex string to then convert back to an integer.</p>
  
  <p>The code that converts is shown below:</p>
  
  <pre><code>int in2 = new Integer(mycard.resourceid.toString());
  String hex = Integer.toHexString(in2);
  </code></pre>
  
  <p>If someone could nudge me in the right direction I would be most appreciative.</p>
  
  <pre><code>int in3 = new Integer(hex.length());
  int in4 = new Integer (in3 - 4);
  String mystring = hex.subString(in4, in3);
  </code></pre>