Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Formatter;
- public class FormatExample {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int a = 0;
- try {
- a = new Integer(in.next());
- }
- catch (Exception e) {
- }
- in.close();
- Formatter formatter = new Formatter();
- formatter.format("%02d", a);
- System.out.println(formatter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement