Find Last Index Array Javascript Push Function Java