public static List<Field> getValidFields(final Field[] fields, final boolean returnFinalFields) {
        final List<Field> validFields = new ArrayList<Field>();
        // we ignore static and final fields
        for (final Field field : fields) {
            if (!Modifier.isStatic(field.getModifiers()) && (returnFinalFields || !Modifier.isFinal(field.getModifiers()))) {
                validFields.add(field);
            }
        }
        return validFields;
    }
public static List < Field > getValidFields ( final Field [ ] fields , final boolean returnFinalFields ) { final List < Field > validFields = new ArrayList < Field > ( ) ; for ( final Field field : fields ) { if ( ! Modifier . isStatic ( field . getModifiers ( ) ) && ( returnFinalFields || ! Modifier . isFinal ( field . getModifiers ( ) ) ) ) { validFields . add ( field ) ; } } return validFields ; }
Scans the array fields and returns any fields that are not static or (optionally) final.

@param fields            the fields to process
@param returnFinalFields include final fields in the results
@return the valid fields