How to create a sub array from another array in Java?

前端 未结 9 497
醉话见心
醉话见心 2020-11-29 16:02

How to create a sub-array from another array? Is there a method that takes the indexes from the first array such as:

methodName(object array, int start, int          


        
9条回答
  •  春和景丽
    2020-11-29 16:31

    int newArrayLength = 30; 
    
    int[] newArray = new int[newArrayLength];
    
    System.arrayCopy(oldArray, 0, newArray, 0, newArray.length);
    

提交回复
热议问题