FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
javaprogram/String Reverse at master · devesh-dev/javaprogram · GitHub
devesh-dev
javaprogram
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
javaprogram
/
String Reverse
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (17 loc) · 475 Bytes
Breadcrumbs
javaprogram
/
String Reverse
Copy path
File metadata and controls
23 lines (17 loc) · 475 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
23
package com.journaldev.javaprograms;
public class JavaReverseString {
public static void main(String[] args) {
System.out.println(reverseString("abc"));
System.out.println(reverseString("123!@#098*"));
}
public static String reverseString(String in) {
if (in == null)
return null;
StringBuilder out = new StringBuilder();
int length = in.length();
for (int i = length - 1; i >= 0; i--) {
out.append(in.charAt(i));
}
return out.toString();
}
}
Back
|
FazBrowse Home
|
New Git URL