Here you can find the source of computeSampleSizeLarger(int w, int h, int minSideLength)
public static int computeSampleSizeLarger(int w, int h, int minSideLength)
//package com.java2s; public class Main { public static int computeSampleSizeLarger(int w, int h, int minSideLength) { int initialSize = Math.max(w / minSideLength, h / minSideLength); if (initialSize <= 1) return 1; return initialSize <= 8 ? prevPowerOf2(initialSize) : initialSize / 8 * 8;/*from ww w . j a v a 2s . c o m*/ } public static int computeSampleSizeLarger(float scale) { int initialSize = (int) Math.floor(1f / scale); if (initialSize <= 1) return 1; return initialSize <= 8 ? prevPowerOf2(initialSize) : initialSize / 8 * 8; } private static int prevPowerOf2(int n) { if (n <= 0) throw new IllegalArgumentException(); return Integer.highestOneBit(n); } }