Print out every n-th item of array list depeding on the number of items : I have an array list : 

    ArrayList<String> melody = new ArrayList<>();


And it contains strings like EEAABB, AAGDFE ...
The size of list may varry

Now depending of the size i would like to print out every N-th string, and the last few of string.

For example :

 1. melody has 2037 elements : i would like to print out every 100th element and last 5 

 2. melody has 100 elements : i would like to print every 10th element and the last 5 

The 100 and the 10 dont need to be fixed numbers, they are here just for example.

My issue here is how to find out, depending on the size of the list, which n-th element should i print.
I want it to be scalable as much as possible.
I know how to print out elements of the list, but i dont know how to determine with what frequency i would print them on the screen (especially when i have little elements in the array).
