Good day guys. I have to build a method that prints only a section of an array.
I set it up like this:
printArray1( intList, countOfInts, 3, 6 );
because it denotes that it prints inclusively between array[3] and array[6].
My problem is that I do not know how to build into the method the sectioning off part.
This is what I've come up with.
static public int printArray1( int[] intList, int countofInts, ???, ???) { if (countofInts >= 0 && (intList.length-9 <= countofInts && countofInts >= (intList.length-6) )) { for (int i = 0; i < countofInts; i++) { System.out.print(intList[i] + "\t "); } } return countofInts; }
How to incorporate this sectioning off into the method?
Earlier in the program it reads a file then stores the info into an array. How do I get the method to only print that certain section of the array?
the numbers 3, 6 refer to the position of the array not the information stored in the array slot.