java
reverse string
5 years, 4 months ago
import java.lang.*;
import java.io.*;
import java.util.*;
class ReverseString
{
public static void main(String[] args)
{
String input = "KoderPlace";
byte [] strAsByteArray = input.getBytes();
byte [] result = new byte [strAsByteArray.length];
for (int i = 0; i<strAsByteArray.length; i++)
result[i] =
strAsByteArray[strAsByteArray.length-i-1];
System.out.println(new String(result));
}
}
0 Comments
Please Login to Comment Here