Postgresql Get Index Of Element In Arraylist Sort In Java