How to remove comma after last digit in java?

ever hear of google?

But, just as a note, if you're listing numbers,
print the first (easy to know when that happens) and then prefix all the rest with a comma. That way, at the end of the list, there is no trailing comma.