Advertisement
Guest User

Reverse String

a guest
May 24th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. public class Lucas {
  2.  
  3.     public static void main(String[] argv)
  4.     {
  5.         System.out.println(Reverse("Lucas is so sexy, but this is reverse : ("));
  6.     }
  7.    
  8.     private static String Reverse(String text)
  9.     {
  10.         StringBuilder Return = new StringBuilder("");
  11.         char[] chars = text.toCharArray();
  12.         int i = chars.length -1;
  13.         while(i >= 0)
  14.         {
  15.             Return.append(chars[i]);
  16.             i--;
  17.         }
  18.         return Return.toString();
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement