Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - st
(boolean[] original, int start, int end)
| 3684 | * @since 1.6 |
| 3685 | */ |
| 3686 | public static boolean[] copyOfRange(boolean[] original, int start, int end) { |
| 3687 | if (start <= end) { |
| 3688 | if (original.length >= start && 0 <= start) { |
| 3689 | int length = end - start; |
| 3690 | int copyLength = Math.min(length, original.length - start); |
| 3691 | boolean[] copy = new boolean[length]; |
| 3692 | System.arraycopy(original, start, copy, 0, copyLength); |
| 3693 | return copy; |
| 3694 | } |
| 3695 | throw new ArrayIndexOutOfBoundsException(); |
| 3696 | } |
| 3697 | throw new IllegalArgumentException(); |
| 3698 | } |
| 3699 | |
| 3700 | public static <T> T[] copyOf(T[] original, int newLength, Class<? extends T[]> newType) { |
| 3701 | if (newLength < 0) { |