Runde Dezimalstellen in Java -Saite
package com.mkyong.math.rounding;
public class StringFormatExample {
public static void main(String[] args) {
double input = 1205.6358;
System.out.println("salary : " + input);
// round half-up, no way control
// 1205.64
System.out.println("salary : " + String.format("%.2f", input));
// 1205.64
System.out.format("salary : %.2f", input);
}
}
Ashamed Angelfish