First thing it's not about java...
No where it states java .....
This is a queue theory which I really don't know the basis behind it...(I only read it once didn't bother to understand fully )
if u can't write it in java why don't u write pseudo code then @ least u have done the needed part then someone can help u on converting it to Java as u say...