Skip to content

Instantly share code, notes, and snippets.

@jyhjuzi
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyhjuzi/4f26f7112cf58d9fcd2d to your computer and use it in GitHub Desktop.
Save jyhjuzi/4f26f7112cf58d9fcd2d to your computer and use it in GitHub Desktop.
public class Q1_2{
public static void main(String args[]){
char[] test = {'a','b','c,'d','e','f'};
reverse(test);
for(char c:test)
System.out.println(c);
}
void reverse(char[] str){
int length=str.length;
for(int i = 0, j= length-1;i<j;){
char temp = str[i];
str[i]=str[j];
str[j]=temp;
i++;
j--;
}
}
}
@pchong90
Copy link

There is syntax highlighting if you set your file to Java. It will be easier to read if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment