Java tutorial
//package com.java2s; //License from project: Apache License import java.text.DecimalFormat; public class Main { /** * Process dp value. */ public static String toDp(double size) { //Rounding-off method. Remain 1 decimal number. DecimalFormat decimalFormat = new DecimalFormat("#0.0dp"); return decimalFormat.format(size); } }