Here you can find the source of getContactCount(Bitmap bitmap)
public static int getContactCount(Bitmap bitmap)
//package com.java2s; import android.graphics.Bitmap; public class Main { public static int getContactCount(Bitmap bitmap) { int toReturn = 0; int hlen = bitmap.getWidth(), vlen = bitmap.getHeight(); for (int i = 0; i < vlen; i++) { for (int j = 0; j < hlen; j++) { if ((bitmap.getPixel(j, i) & 0xff) > 0) { // check right border if (j + 1 < hlen && (bitmap.getPixel(j + 1, i) & 0xff) > 0) { toReturn++;/*from w w w . j a v a 2s .c o m*/ } // check bottom border if (i + 1 < vlen && (bitmap.getPixel(j, i + 1) & 0xff) > 0) { toReturn++; } } } } return toReturn; } }