if (selected instanceof Object[]) { Object[] selectedIf = (Object[]) selected; for (Object item : selectedIf) {
if (selected.getClass().isArray()) { int length = Array.getLength(selected); for (int i=0; i<length; ++i) { Object item = Array.get(selected, i);
    protected boolean isItemSelected(Object value, Object selected) {        // Since this is a checkbox, there could be more than one checked value, which means        // this could be a single value type, array or collection        if (selected != null) {            String stringValue = (value == null) ? "" : format(value);            if (selected instanceof Object[]) {                Object[] selectedIf = (Object[]) selected;                for (Object item : selectedIf) {                    if ( (format(item).equals(stringValue)) ) {                        return true;                    }                }            }            else if (selected instanceof Collection) {                Collection selectedIf = (Collection) selected;                for (Object item : selectedIf) {                    if ( (format(item).equals(stringValue)) ) {                        return true;                    }                }            }            else {                if( format(selected).equals(stringValue) ) {                    return true;                }            }        }        // If we got this far without returning, then this is not a selected item        return false;    }