DecimalFormat a = new DecimalFormat("#,###.000"); System.out.println(a.format(Long.MAX_VALUE)); System.out.println(a.format(Long.MIN_VALUE));