public static void main(String[] args) {
int batchSize = 1000;
int size = 10000;
int idxLimit = Math.min(batchSize, size);
System.out.println(idxLimit);

idxLimit = Math.min(idxLimit + batchSize, size);
System.out.println(idxLimit);

idxLimit = Math.min(10001, size);
System.out.println(idxLimit);

idxLimit = Math.max(10001, size);
System.out.println(idxLimit);
}