Integer.valueOf() vs. Integer.parseInt() [duplicate]

This question already has answers here: Different between parseInt() and valueOf() in java? (11 answers) Closed 4 years ago. Aside from Integer.parseInt() handling the minus sign (as documented), are there any other differences between Integer.valueOf() and Integer.parseInt()? And since neither can parse , as a decimal thousands separator (produces NumberFormatException), is there an already available … Read more

How to change the decimal separator of DecimalFormat from comma to dot/point?

I have this little crazy method that converts BigDecimal values into nice and readable Strings. private String formatBigDecimal(BigDecimal bd){ DecimalFormat df = new DecimalFormat(); df.setMinimumFractionDigits(3); df.setMaximumFractionDigits(3); df.setMinimumIntegerDigits(1); df.setMaximumIntegerDigits(3); df.setGroupingSize(20); return df.format(bd); } It however, also produces a so called grouping separator “,” that makes all my values come out like this: xxx,xxx I do need … Read more

Formatting a number with exactly two decimals in JavaScript

I have this line of code which rounds my numbers to two decimal places. But I get numbers like this: 10.8, 2.4, etc. These are not my idea of two decimal places so how I can improve the following? Math.round(price*Math.pow(10,2))/Math.pow(10,2); I want numbers like 10.80, 2.40, etc. Use of jQuery is fine with me. 3Best … Read more