Hello I'm just a beginner in java and i have a problem adding a comma on a string of digits like for example 1000 will be 1,000 in output .
i can use :
String digitsWithComma = "";
digitsWithComma = str.substring(0,1) + "," + str.substring(1);
but the problem is it only works on a thousand not on a higher digits. can someone please help me with this