Pregunta de entrevista de TireBuyer.com

how to reverse a string?

Respuesta de la entrevista

Anónimo

11 ene 2012

public class reverse { public static String reverseIt(String a) { int length = a.length(); StringBuilder reverse = new StringBuilder(); for(int i = length; i > 0; --i) { char result = a.charAt(i-1); reverse.append(result); } return reverse.toString(); } }