Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int indexOfLast(Object[] array, Class<?> type) { if (!isEmpty(array)) { for (int N = array.length; N > 0; N--) { Object one = array[N - 1]; if (one != null && one.getClass() == type) { return N - 1; } } } return -1; } public static <T> boolean isEmpty(T[] array) { return array == null || array.length == 0; } }