|
|
@ -17,13 +17,14 @@ public class ArrayManipulation { |
|
|
|
|
|
|
|
int[] arr = {1,2,3,4,5}; |
|
|
|
System.out.println(Arrays.toString(reverseArray(arr))); |
|
|
|
System.out.println(Arrays.toString(reverseArray(arr))); |
|
|
|
System.out.println("Hello"); |
|
|
|
} |
|
|
|
// quadriert werte im array |
|
|
|
public static int[] squareEach(int[] arr){ |
|
|
|
int[] back = new int[arr.length]; |
|
|
|
for(int i = 0; i < arr.length; i++){ |
|
|
|
back[i] = arr[i] * arr[i]; |
|
|
|
arr[i] = arr[i] * arr[i]; |
|
|
|
} |
|
|
|
return back; |
|
|
|
return arr; |
|
|
|
} |
|
|
|
} |