[Solved] If I have an array of 5 elements lets say (1,2,3,4,5) how do create a new one with double each integer?
[ad_1] if you want values in a new array, then int[] array ={1,2,3,4,5}; int arrayLength = array.size(); int[] array2 = new int[arrayLength]; for(int i=0; i<arrayLength; i++) { array2[i] = array[i]*2; } If you want values doubles in the same array, then int[] array ={1,2,3,4,5}; for(int i=0; i<array.size(); i++) { array[i]*=2; } 0 [ad_2] solved If … Read more