Java Math RoundingMode枚举 Java Math MathContext.toString() 方法 JavaZip Adler32.reset() 方法 Java Math RoundingMode枚举 package com.codingdict; import java.math.*; public class RoundingModeDemo { public static void main(String[] args) { // create 2 RoundingMode objects RoundingMode rm1, rm2; // create and assign values to rm and name int rm = 5; String name = "UP"; // static methods are called using enum name // assign the the enum constant of rm to rm1 rm1 = RoundingMode.valueOf(rm); // assign the the enum constant of name to rm2 rm2 = RoundingMode.valueOf(name); String str1 = "Enum constant for integer " + rm + " is " +rm1; String str2 = "Enum constant for string " + name + " is " +rm2; // print rm1, rm2 values System.out.println( str1 ); System.out.println( str2 ); String str3 = "Enum constants of RoundingMode in order are :"; System.out.println( str3 ); // print the array of enum constatnts using for loop for (RoundingMode c : RoundingMode.values()) System.out.println(c); } } Java Math MathContext.toString() 方法 JavaZip Adler32.reset() 方法