public static void main(String args[]) throws InterruptedException{
        ExecutorService executors = Executors.newFixedThreadPool(100);
        MinMaxKeeper mmKeeper = new MinMaxKeeper();
        
        for(int i=0 ; i < 100000; i++){
            GenerateRand rand = new GenerateRand(mmKeeper, i);
            executors.execute(rand);
        }
        
        executors.shutdown();
        executors.awaitTermination(10, TimeUnit.SECONDS);
        
        assert mmKeeper.getMin() == -1;
        assert mmKeeper.getMax() == 1000001;
    }
Threadsafe way of updating min and max
@param value
src/com/interview/multithreaded/MinMaxKeeper.java