Here you can find the source of inverterString(String palavra)
public static String inverterString(String palavra)
//package com.java2s; //License from project: Open Source License public class Main { public static String inverterString(String palavra) { if (isEmpty(palavra)) return ""; String[] letras = palavra.split(""); int ultimoValor = letras.length - 1; StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i <= ultimoValor; i++) { stringBuilder.append(letras[ultimoValor - i]); }//from w w w . j a v a 2s.co m return stringBuilder.toString(); } public static boolean isEmpty(String palavra) { if (palavra == null) return true; return palavra.trim().length() == 0; } }