static float img_leftishness(BWImage image) { float middle = image.getWidth()/2f; float sum = 0; for (int y = 0; y < image.getHeight(); y++) { int x1 = img_leftmostPoint(image, y); int x2 = img_rightmostPoint(image, y); if (x2 > x1) { float center = (x1+x2)/2f; sum += (middle-center)/middle; } } ret sum/image.getHeight(); }