Java Get Last Index Of Array Javascript Push Function In Python