I wish to save some Double to an array, and I just need to have 2 decimal places Double. So I rounded the origin double to 2 decimal places, and when I print the rounded Double, the result is correct. However when I save these Double to an array and print the Double, the result becomes many decimal place.
What should I do to force only 2 decimal Double in the array?
For example:
Double -> 2.344563343534 // Original value
rounded -> 2.35 // Rounded value I want
After I save the rounded Double to array and print:
Double in array -> 2.34444444444444 // I hope this value only in 2 decimal place.