Java int type format via NumberFormat

Description

Java int type format via NumberFormat


import java.text.NumberFormat;
import java.util.Locale;
public class Main {
   public static void main(String[] args) {
      int number = 1234567;
      NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
      String numberAsString = numberFormat.format(number);
      System.out.println(numberAsString);
   }// w w w  .  j av a 2s .co  m
}



PreviousNext

Related