Java Size byteCountToDisplaySize(long size)

Here you can find the source of byteCountToDisplaySize(long size)

Description

byte Count To Display Size

License

Open Source License

Declaration

public static String byteCountToDisplaySize(long size) 

Method Source Code

//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);
    }
}

Related

  1. byteCountToDisplaySize(long bytes)
  2. byteCountToDisplaySize(long size)
  3. byteCountToDisplaySize(long size)
  4. byteSizeString(long bytes)
  5. BytesToHRSize(String len)
  6. bytesToSizeFormat(long bytes)