Archive for March 2012
Reverse a String in Java

One of the frequently asked questions in interviews, let's try few ways available in JDK to reverse a string:
import java.util.Stack;
public class StringReverse {
public static String reverse1(String s) {
int length = s.length();
if (length.