If it will always be five hundred, you can do this:
for(int i = 0; i < Integer.MAX_VALUE; i++){ if(i*500+1 >= x && (i+1)*500 < x){ System.out.println("X is between " + (i*500 + 1) + " and " + ((i+1) * 500)); } }
If the variable 'x' is an identifier.
If you need to use folder names, you will need to read the folder names, divide by "-", and then try to parse them into integers and use them instead of the for loop.
source share