FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaArithmetic/src/LeetCode/LeetCode7.java at master · feinibuai/JavaArithmetic · GitHub
feinibuai
JavaArithmetic
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaArithmetic
/
src
/
LeetCode
/
LeetCode7.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (14 loc) · 439 Bytes
Breadcrumbs
JavaArithmetic
/
src
/
LeetCode
/
LeetCode7.java
Copy path
File metadata and controls
15 lines (14 loc) · 439 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package
LeetCode
;
class
LeetCode7
{
public
int
reverse
(
int
x
) {
int
rev
=
0
;
while
(
x
!=
0
) {
int
pop
=
x
%
10
;
x
/=
10
;
if
(
rev
>
Integer
.
MAX_VALUE
/
10
|| (
rev
==
Integer
.
MAX_VALUE
/
10
&&
pop
>
7
))
return
0
;
if
(
rev
<
Integer
.
MIN_VALUE
/
10
|| (
rev
==
Integer
.
MIN_VALUE
/
10
&&
pop
< -
8
))
return
0
;
rev
=
rev
*
10
+
pop
;
}
return
rev
;
}
}
Back
|
FazBrowse Home
|
New Git URL