title: How to round a value of a String to 2 decimal places
body: <p>I have a String which is taken from a JSON file. I need to convert it to double or int and then round it to 2 decimal places and if its an int, round to 1 digit</p>
  
  <p>for example: if it is 76424443 it should be rounded to 76.4
  or if it is 7.122345936298 should be rounded to 7.12</p>
  
  <p>This is what I have done so far.</p>
  
  <pre><code>int value = Integer.parseInt(value1);
  value1 = String.valueOf(Math.round(value));
  </code></pre>
  
  <p>I also do not know if the value is double or int, should be something that works with both.</p>