Format data using Java class Numberformat

zhaozj2021-02-16  53

// use number format formatted data import java.text. *; import java.util. *;

public class IntegerSample {public static void main (String args []) {int amount = 54321; NumberFormat myformat = NumberFormat.getInstance (); // system format System.out.println (myformat.format (amount)); NumberFormat usformat = NumberFormat.getIntegerInstance (Locale.US); // use format System.out.println (usformat.format (amount)); NumberFormat germanformat = NumberFormat.getInstance (Locale.CHINA); // china format System.out.println (germanformat .format (Amount); Numberformat Jaformat = NumberFormat.GetInstance (locale.japan); // japan format system.out.println (jaformat.format (amount));}

}

// --------------------------------- //

operation result:

F: / 2004-04-12> Java integersample54, 32154, 32154, 32154, 321

转载请注明原文地址:https://www.9cbs.com/read-23099.html

New Post(0)