Java tutorial
//package com.java2s; public class Main { public static boolean isNearRatio16_9(int width, int height) { if (width < height) { int tmp = width; width = height; height = tmp; } if (Math.abs((double) width / height - 4.0 / 3.0) > Math.abs((double) width / height - 16.0 / 9.0)) { return true; } return false; } }