Write code to reverse a string by appending its char element backward to a StringBuilder
//package com.book2s; public class Main { public static void main(String[] argv) { String input = "book2s.com"; System.out.println(reverse(input)); }//ww w .j a v a 2 s . c o m public static String reverse(String input) { StringBuilder result = new StringBuilder(); for (int i = input.length() - 1; i >= 0; i--) { result.append(input.charAt(i)); } return result.toString(); } }