Here you can find the source of invert(final String s)
public static String invert(final String s)
//package com.java2s; //License from project: Open Source License public class Main { public static String invert(final String s) { char[] cs = s.toCharArray(); char[] result = new char[s.length()]; int j = 0; int i = s.length() - 1; while (i >= 0) { result[j++] = cs[i--];/* w w w .j av a 2 s. c o m*/ } return new String(result); } }