Here you can find the source of byteCountToDisplaySize(long size)
public static String byteCountToDisplaySize(long size)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Abel G?mez.//w w w. j av a 2 s . c o m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Abel G?mez - initial API and implementation ******************************************************************************/ import java.text.MessageFormat; public class Main { public static String byteCountToDisplaySize(long size) { int MB = 1024 * 1024; return MessageFormat.format("{0} MB", size / MB); } }