code: private static int calcCombinedIntensity(final int element) {
          final Color color = new Color(element);
          return Math.min(255, (color.getRed() + color.getGreen() + color.getRed()) / 3);
      }
docs: Calculate the combined intensity of a pixel and normalizes it to a value of at most 255.
  
  @param element
  @return