Here you can find the source of getSizeSIZE(List
private static Size getSizeSIZE(List<Size> sizes, int w, int h)
//package com.java2s; import java.util.List; import android.hardware.Camera.Size; public class Main { private static Size getSizeSIZE(List<Size> sizes, int w, int h) { Size re = null;/*from w w w. ja va2 s .c o m*/ int wantSize = w * h; int minGap = wantSize; for (Size size : sizes) { if (getSizeGap(size, wantSize) < minGap) { re = size; minGap = getSizeGap(size, wantSize); } } return re; } private static int getSizeGap(Size size, int wantSize) { return Math.abs(size.width * size.height - wantSize); } }