public class NumericalDigitDataTest { public static void main(String[] args) { double doubleVal1 = 999999999999999.0D; double doubleVal2 = 999999999999999.4D; double doubleVal3 = 999999999999999.5D; double doubleVal4 = 999999999999999.9D; String str1 = String.format("%15.0f", Math.floor(doubleVal1)); String str2 = String.format("%15.0f", Math.floor(doubleVal2)); String str3 = String.format("%15.0f", Math.floor(doubleVal3)); String str4 = String.format("%15.0f", Math.floor(doubleVal4)); System.out.printf("str1 [%s]\n", str1); System.out.printf("str2 [%s]\n", str2); System.out.printf("str3 [%s]\n", str3); System.out.printf("str4 [%s]\n", str4); } }