I haveStart by turning those Strings into doubles.
String num = "123.33"
String num1 = "123.9"
if i want to display like
How can i do that?
String num = "123.90"; double x = Double.valueOf(num); NumberFormat formatter = NumberFormat.getCurrencyInstance(); System.out.println(formatter.format(x));
is there any way to keep two decimal point without using double?You have no idea what you're doing. The number of decimal points should be purely a display condition. NumberFormat is the way to accomplish that.
is there any way to keep two decimal point withoutof course. you could store the amount as a string or use BigDecimal and define the precision. but the response about floating point issues are real and you need to be aware of them because they will inevitably get you!