forked from PacktPublishing/Java-Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (22 loc) · 1.12 KB
/
Main.java
File metadata and controls
31 lines (22 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package modern.challenge;
public class Main {
private static final String NRI = "255500";
private static final String NRL = "25550049303";
public static void main(String[] args) {
int result1i = Integer.parseUnsignedInt(NRI);
int result2i = Integer.parseUnsignedInt(NRI, Character.MAX_RADIX);
int result3i = Integer.parseUnsignedInt(NRI, 1, 4, Character.MAX_RADIX);
System.out.println("Result 1i: " + result1i);
System.out.println("Result 2i: " + result2i);
System.out.println("Result 3i: " + result3i);
long result1l = Long.parseUnsignedLong(NRL);
long result2l = Long.parseUnsignedLong(NRL, Character.MAX_RADIX);
long result3l = Long.parseUnsignedLong(NRL, 1, 4, Character.MAX_RADIX);
System.out.println("Result 1l: " + result1l);
System.out.println("Result 2l: " + result2l);
System.out.println("Result 3l: " + result3l);
// 2147483648 is Integer.MAX_VALUE + 1
int maxValuePlus = Integer.parseUnsignedInt("2147483648");
System.out.println("Result maxValuePlus: " + maxValuePlus);
}
}