Category Archives: Strings

Optimized String Reverse Algorithm…

package com.test.stringOps; public class StringReverse { public static String reverse(String str) { if (str == null || str.length() == 0) { return str; } else { StringBuilder bul = new StringBuilder(str); for(int i=0,j=bul.length()-1;i char c=bul.charAt(i); bul.setCharAt(i, bul.charAt(j)); bul.setCharAt(j, c); } … Continue reading

Posted in Strings | Leave a comment