http://www.dk101.com/Discuz/viewthread.php?tid=23861 NumberFormat formatter = new DecimalFormat("000000"); String s = formatter.format(-1234.567); // -001235 formatter = new DecimalFormat("##"); s = formatter.format(-1234.567); // -1235 s = formatter.format(0); // 0 formatter = new DecimalFormat("##00"); s = formatter.format(0); // 00