The javadoc of Class.getFields() says: "Returns an array containing Field objects reflecting all the accessible public fields of the class", so the isPublic check shouldn't be necessary.