// Converted the String into Char array
char[] a = str.toCharArray();
// create a new String
StringBuilder sb = new StringBuilder();
// Started a loop
for (int i = a.length - 1; i >= 0; i--) {
// Add character
sb.append(a[i]);
}
// Print out the string
System.out.println(sb);