private static Integer getScaledComponent(Object value) {
    if (value instanceof Number) {
      double doubleValue = ((Number)value).doubleValue();
      int component = (int)(doubleValue * 255 + 0.5);
      if (component >= 0 && component <= 255) {
        return component;
      }
    }
    return null;
  }
private static Integer getScaledComponent(Object value)