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
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
This is what I have done so far.
int value = Integer.parseInt(value1);
value1 = String.valueOf(Math.round(value));
I also do not know if the value is double or int, should be something that works with both.