How do I create a subarray of an array in Java. Given a number 3 and x [2,4,6,30,9]
, the answer is X1[2,4,6] X2[4,6,30] X3[6,30,9]
This is what I have so far, but it only prints the first three elements. I also have to print the median of every subArray.
double[] floatsArr = new double[3];
// floats is the array with all the elements in
for(int i = 0; i < floats.length; i++){
for(int k = 1; k < (filterSize+1); k++){
floatsArr[k] = floats[k];
System.out.println(floatsArr[k]);
}
}