- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSolution7.java
More file actions
Latest commit
executable file
·32 lines (25 loc) · 737 Bytes
/
Copy pathSolution7.java
File metadata and controls
executable file
·32 lines (25 loc) · 737 Bytes
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
32
/**
* Created by slade on 2019/5/30.
*/
publicclassSolution7 {
//7. Reverse Integer
publicintreverse(intx) {
intrev = 0;
while (x != 0) {
intpop = x % 10;
x /= 10;
if (rev > Integer.MAX_VALUE / 10 || (rev == Integer.MAX_VALUE / 10 && pop > 7)) return0;
if (rev < Integer.MIN_VALUE / 10 || (rev == Integer.MIN_VALUE / 10 && pop < -8)) return0;
rev = rev * 10 + pop;
}
returnrev;
}
publicstaticvoidmain(String[] args) {
Solution7s = newSolution7();
inti = s.reverse(1219);
// System.out.println(i);
inta = 5;
a += a *= a %= 3;
System.out.println(a);
}
}