package com.growingwiththeweb.algorithms.interviewquestions.reversestring;

public class Program {
    public static void main(String[] args) {
        assert reverse1("abc123def").equals("fed321cba");
        assert reverse2("abc123def").equals("fed321cba");
        assert reverse3("abc123def").equals("fed321cba");
        assert reverse1("abcd1234").equals("4321dcba");
        assert reverse2("abcd1234").equals("4321dcba");
        assert reverse3("abcd1234").equals("4321dcba");

        System.out.println("Tests passed");
    }

    public static String reverse1(String text) {
        char[] charArray = text.toCharArray();
        int start = -1;
        int end = charArray.length;
        while (++start < --end) {
            char temp = charArray[start];
            charArray[start] = charArray[end];
            charArray[end] = temp;
        }
        return String.valueOf(charArray);
    }

    public static String reverse2(String text) {
        StringBuilder sb = new StringBuilder();
        for (int i = text.length() - 1; i >= 0; i--) {
            sb.append(text.charAt(i));
        }
        return sb.toString();
    }

    public static String reverse3(String text) {
        return new StringBuilder(text).reverse().toString();
    }
}

@@ -155,25 +155,36 @@
 sert reverse
-1
+ViaCharArray
 (%22abc123def%22
@@ -224,25 +224,41 @@
 sert reverse
-2
+ViaStringBuilderA
 (%22abc123def%22
@@ -298,25 +298,41 @@
 sert reverse
-3
+ViaStringBuilderB
 (%22abc123def%22
@@ -376,17 +376,28 @@
  reverse
-1
+ViaCharArray
 (%22abcd12
@@ -443,17 +443,33 @@
  reverse
-2
+ViaStringBuilderA
 (%22abcd12
@@ -515,17 +515,33 @@
  reverse
-3
+ViaStringBuilderB
 (%22abcd12
@@ -649,17 +649,28 @@
  reverse
-1
+ViaCharArray
 (String 
@@ -1033,17 +1033,33 @@
  reverse
-2
+ViaStringBuilderA
 (String 
@@ -1287,17 +1287,33 @@
  reverse
-3
+ViaStringBuilderB
 (String 

Update reverse string method names