Here you can find the source of rgbToGray(int pixels)
public static int rgbToGray(int pixels)
//package com.java2s; //License from project: Apache License public class Main { public static int rgbToGray(int pixels) { // int _alpha = (pixels >> 24) & 0xFF; int _red = (pixels >> 16) & 0xFF; int _green = (pixels >> 8) & 0xFF; int _blue = (pixels) & 0xFF; return (int) (0.3 * _red + 0.59 * _green + 0.11 * _blue); }/*from w ww .ja va 2 s . c o m*/ }