- Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy path_3270.java
22 lines (21 loc) · 932 Bytes
/
_3270.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
packagecom.fishercoder.solutions.fourththousand;
publicclass_3270 {
publicstaticclassSolution1 {
publicintgenerateKey(intnum1, intnum2, intnum3) {
String[] padded = newString[3];
padded[0] = String.format("%04d", num1);
padded[1] = String.format("%04d", num2);
padded[2] = String.format("%04d", num3);
StringBuildersb = newStringBuilder();
for (inti = 0; i < padded[0].length(); i++) {
sb.append(
Math.min(
Character.getNumericValue(padded[0].charAt(i)),
Math.min(
Character.getNumericValue(padded[1].charAt(i)),
Character.getNumericValue(padded[2].charAt(i)))));
}
returnInteger.parseInt(sb.toString());
}
}
}