|
@ -1,5 +1,5 @@ |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
/*e*/ |
|
|
|
|
|
|
|
|
|
|
|
public class ArrayManipulation { |
|
|
public class ArrayManipulation { |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -13,10 +13,27 @@ public class ArrayManipulation { |
|
|
return arr; |
|
|
return arr; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static int[] removeFirst(int[] arr) { |
|
|
|
|
|
|
|
|
|
|
|
int[] result = new int[arr.length - 1]; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < arr.length; i++) { |
|
|
|
|
|
|
|
|
|
|
|
if (i == 0){continue;} |
|
|
|
|
|
result[i - 1] = arr[i]; |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
|
int[] arr = {1,2,3,4,5}; |
|
|
int[] arr = {1,2,3,4,5}; |
|
|
System.out.println(Arrays.toString(reverseArray(arr))); |
|
|
System.out.println(Arrays.toString(reverseArray(arr))); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println(Arrays.toString(removeFirst(arr))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |