Java tutorial
//package com.java2s; public class Main { public static int displayWidth; private static int designWidth; public static int getDisplayWidthValue(int designWidthValue) { if (Math.abs(designWidthValue) < 2) { return designWidthValue; } return designWidthValue * displayWidth / designWidth; } }