How to get slice of a Primitive Array in Java
Given a Primitive Array, the task is to get a Slice of this array in Java, using start and ending index. Examples: Input: arr[] = {1, 2, 3, 4, 5}, startIndex = 2, endIndex = 4 Output: {3, 4, 5} Input: arr[] = {1, 2, 3, 4, 5}, startIndex = 0, endIndex = 1 Output: {1, 2}Method 1: Naive Method.Get the