-
-
Save hazartilirot/13145b04e3fc8f136b20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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