string.format

187 阅读1分钟

double num = 3.1415926; String format = String.format("%.2f", num); System.err.println(format);