int index = arrayList.indexOf("4"); if (index == -1)
System.out.println("not contain 4"); else
System.out.println("4 at index :" + index);
int lastIndex = arrayList.lastIndexOf("1"); if (lastIndex == -1)
System.out.println("not contain 1"); else
System.out.println("Last index :"+ lastIndex);
}
}
/*true
4 at index :3
Last index :5
*/