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

Asked 2 years ago, Updated 2 years ago, 130 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.