equal
deleted
inserted
replaced
119 } |
119 } |
120 } |
120 } |
121 } |
121 } |
122 |
122 |
123 public static String rpad(String s, int n) { |
123 public static String rpad(String s, int n) { |
124 return String.format("%1$-" + n + "s", s); |
124 if (n > 0) { |
|
125 return String.format("%1$-" + n + "s", s); |
|
126 } else { |
|
127 return s; |
|
128 } |
125 } |
129 } |
126 |
130 |
127 public static String lpad(String s, int n) { |
131 public static String lpad(String s, int n) { |
128 return String.format("%1$" + n + "s", s); |
132 if (n > 0) { |
|
133 return String.format("%1$" + n + "s", s); |
|
134 } else { |
|
135 return s; |
|
136 } |
129 } |
137 } |
130 |
138 |
131 public static String repeat(char ch, int count) { |
139 public static String repeat(char ch, int count) { |
132 char[] array = new char[count]; |
140 char[] array = new char[count]; |
133 Arrays.fill(array, ch); |
141 Arrays.fill(array, ch); |