[java] java: ArrayList - how can I check if an index exists?