FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-coding-problems/src/ReverseString.java at main · jfullstackdev/java-coding-problems · GitHub
jfullstackdev
/
java-coding-problems
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
6
Star
35
Code
Pull requests
0
Discussions
Actions
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
java-coding-problems
/
src
/
ReverseString.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (15 loc) · 444 Bytes
Breadcrumbs
java-coding-problems
/
src
/
ReverseString.java
Copy path
File metadata and controls
22 lines (15 loc) · 444 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
16
17
18
19
20
21
22
public
class
ReverseString
{
public
static
void
main
(
String
[]
args
) {
String
str
=
"789"
;
System
.
out
.
println
(
reverseString
(
str
));
}
public
static
String
reverseString
(
String
in
) {
if
(
in
==
null
)
throw
new
IllegalArgumentException
(
"input null"
);
StringBuilder
out
=
new
StringBuilder
();
char
[]
chars
=
in
.
toCharArray
();
for
(
int
i
=
chars
.
length
-
1
;
i
>=
0
;
i
--)
out
.
append
(
chars
[
i
]);
return
out
.
toString
();
}
}
Back
|
FazBrowse Home
|
New Git URL