We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d4f6b3d commit 5a5ddbdCopy full SHA for 5a5ddbd
1 file changed
reverse.java
@@ -0,0 +1,26 @@
1
+# https://www.facebook.com/jyotiprakash.nayak.372/posts/1837128093092133
2
+# subscibed by Code House
3
+import java.lang.*;
4
+import java.io.*;
5
+import java.util.*;
6
+
7
+// Class of ReverseString
8
+class ReverseString {
9
+ public static void main(String[] args)
10
+ {
11
+ String input = "GeeksforGeeks";
12
13
+ // getBytes() method to convert string
14
+ // into bytes[].
15
+ byte[] strAsByteArray = input.getBytes();
16
17
+ byte[] result = new byte[strAsByteArray.length];
18
19
+ // Store result in reverse order into the
20
+ // result byte[]
21
+ for (int i = 0; i < strAsByteArray.length; i++)
22
+ result[i] = strAsByteArray[strAsByteArray.length - i - 1];
23
24
+ System.out.println(new String(result));
25
+ }
26
+}
0 commit comments