KL, Assuming you just want to display the 20 as 00020 then you could do some formatting like:
public class TestNum { public static void main(String[] args) { int x = 20; String numberString = new String(); System.out.println("Option One:"); System.out.println("000" + x); System.out.println(); System.out.println(); //if you want the output to always be 5 long! System.out.println("Option Two:"); for(int i = 0;i < (5 - (Integer.toString(x).length())) ; i++) numberString = numberString + "0"; numberString = numberString + Integer.toString(x); System.out.println(numberString); } } Hope this helps. I am also interested if there is a better way to do this because I am just learning Java my self. Have fun. David T. Wilson At 10:28 AM 11/30/2001 +0800, KL OOI wrote: >Hi all, > >How do I format a integer 20 to 00020 ? > >Thanks. > >Regards, >KL OOI > > > >_________________________________________________________ >Do You Yahoo!? >Get your free @yahoo.com address at http://mail.yahoo.com > > >=========================================================================== >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff >JSP-INTEREST". >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". >Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com