Here you can find the source of format(final long value, final long divider, final String unit)
public static String format(final long value, final long divider, final String unit)
//package com.java2s; //License from project: Open Source License public class Main { public static String format(final long value, final long divider, final String unit) { final double result = divider > 1 ? (double) value / (double) divider : (double) value; return String.format("%.1f %s", result, unit); }//from w ww . jav a 2 s. c o m }