I want to take a comma in a thousand units when converting Integer to String, can I do it?

Asked 1 years ago, Updated 1 years ago, 114 views

If there's a number called 35634646, I'd like to convert it to String, 35,634,646. Is there a simple way to do it?

integer java string

2022-09-21 15:32

1 Answers

Use the Number Format class System.out.println(NumberFormat.getNumberInstance(Locale.US).format(35634646)); If you do this,

You get 35,634,646.


2022-09-21 15:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.