Skip to content

Instantly share code, notes, and snippets.

@hazartilirot
Created January 31, 2012 20:30
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 hazartilirot/13145b04e3fc8f136b20 to your computer and use it in GitHub Desktop.
Save hazartilirot/13145b04e3fc8f136b20 to your computer and use it in GitHub Desktop.
import java.util.Arrays;
/**
* Created by IntelliJ IDEA.
* User: SONYVAIO
* Date: 31.01.12
* Time: 22:23
* To change this template use File | Settings | File Templates.
*/
public class SimpleExample {
public char[] printArray(char[] a) {
char[] b = new char[a.length];
int count = 0;
for(int i = a.length - 1; i >= 0; i--)
b[count++] = a[i];
return b;
}
public static void main(String[] args) {
char[] a = {'a', 'b', 'c', 'd', 'e'};
SimpleExample se = new SimpleExample();
System.out.println("Before: " + Arrays.toString(a));
System.out.println("After: " + Arrays.toString(se.printArray(a)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment