Page Usage Algorithm Java Implementation