Skip to content

Commit b616162

Browse files
committed
step 4
1 parent 4914fc3 commit b616162

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Main.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ public class Main {
22

33
public static void main(String[] args) {
44
for (int i = 0; i < 20; i++) {
5-
System.out.println("Hello " + args[0] + "!");
5+
System.out.println(pad(i+1, 2)+") Hello " + args[0] + "!");
66
}
77
}
8+
9+
private static String pad(int number, int places) {
10+
if(String.valueOf(number).length() < places) {
11+
return String.format("%0"+places+"d", number);
12+
}
13+
14+
return String.valueOf(number);
15+
}
816
}

0 commit comments

Comments
 (0)