How to set thousands separator in Java? I have String representation of a BigDecimal that I want to format with a thousands separator and return as String.
You can use format function with ",";
int no = 124750; String str = String.format("%,d", no); //str = 124,750
"," includes locale-specific grouping characters.
docs
2.1m questions
2.1m answers
60 comments
57.0k users