Results 1 to 1 of 1
- 10-04-2007, 09:34 PM #1
How to display numbers with leading zeros
This program displays numbers with leading zeros.
Java Code:public class number { public static void main(String args[]) { long n = 123456789; String mask = "00000000000000"; String ds = Long.toString(n); // double to string String z = mask.substring(0 , mask.length() - ds.length()) + ds; System.out.println(z); } }
Similar Threads
-
Counting numbers up and down
By radio in forum New To JavaReplies: 4Last Post: 05-06-2011, 03:03 PM -
How to display numbers with leading zeros
By Java Tip in forum java.langReplies: 1Last Post: 06-14-2008, 06:36 PM -
how to display a sum of all previously pressed numbers in JTextField?
By all eyes in forum New To JavaReplies: 2Last Post: 03-30-2008, 08:38 PM -
random numbers
By carlos123 in forum New To JavaReplies: 1Last Post: 12-22-2007, 02:56 AM -
how to swap 2 numbers
By mary in forum Advanced JavaReplies: 1Last Post: 08-02-2007, 05:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks