Why does Java not take -1 as a index as I want it too?