Skip to content

Instantly share code, notes, and snippets.

View sushmaGS-zz's full-sized avatar

Sushma Gurram sushmaGS-zz

View GitHub Profile
@zac-xin
zac-xin / StringReverse.java
Created April 17, 2012 07:41
1.2 Write code to reverse a C-Style String. (C-String means that “abcd” is represented as !ve characters, including the null character.)
public class StringReverse {
public static void main(String args[]){
String s = "this is a demo test!";
System.out.println(reverse(s));
}
public static String reverse(String input){
char[] data = input.toCharArray();
int i = 0;
int j = data.length - 1;