Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

slice array java

   //index   0   1   2   3   4
int[] arr = {10, 20, 30, 40, 50};
Arrays.copyOfRange(arr, 0, 2);          // returns {10, 20}
Arrays.copyOfRange(arr, 1, 4);          // returns {20, 30, 40}
Arrays.copyOfRange(arr, 2, arr.length); // returns {30, 40, 50} (length = 5)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #slice #array #java
ADD COMMENT
Topic
Name
6+8 =