Float (Object value, boolean checkRange) { if (value instanceof Number) { float component = ((Number)value).floatValue(); if (!checkRange || component >= 0.0f && component <= 1.0f) { return component; } } return null; }