1. Digital formatting
Use Java.text.DecimalFormat to format numbers, typically using the DecimalFormat class. Such as:
ImportJava.text.DecimalFormat; Public classdecimalformatdemo{Static Public voidSimpleformat (String pattern,Doublevalue) {DecimalFormat MyFormat=NewDecimalFormat (pattern); String out=Myformat.format (value); System.out.println (Value+ "" +pattern+ "" +Out ); } Public Static voidMain (string[] args) {Simpleformat ("###,###.###", 123456.789); }}
Learn to view other methods of the DecimalFormat class for format processing.
2. Digital operations
2.1 Math Class
such as: Math. Mathematical Methods (trigonometric functions, exponential function, rounding, maximum minimum, absolute value)
2.2 Random Number: Math.random () method
2.3 Random Class
Import Java.util.Random is required, and this class is used to generate random numbers of various basic types, such as Nextint (), nextdouble (), and so on.
2.4 Large numeric operations BigInteger, BigDecimal class
Because the maximum value of the base type int is 2 of 31 minus 1, the BigInteger class is introduced if a larger number is to be computed. When used, import Java.math.Biginteger (BigDecimal) is required.
API Document: http://docs.oracle.com/javase/7/docs/api/
Learning Notes--java Digital processing class