Java tutorial
//package com.java2s; public class Main { public static int getSampleSizeAutoFitToScreen(int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if ((paramInt2 == 0) || (paramInt1 == 0)) return 1; return Math.min(Math.max(paramInt3 / paramInt1, paramInt4 / paramInt2), Math.max(paramInt4 / paramInt1, paramInt3 / paramInt2)); } }