Java tutorial
//package com.java2s; public class Main { static float sPixelDensity = -1f; public static int meterToPixel(float meter) { // 1 meter = 39.37 inches, 1 inch = 160 dp. return Math.round(dpToPixel(meter * 39.37f * 160)); } public static float dpToPixel(float dp) { return sPixelDensity * dp; } public static int dpToPixel(int dp) { return Math.round(dpToPixel((float) dp)); } }