Java Size getSizeFormat()

Here you can find the source of getSizeFormat()

Description

get Size Format

License

Open Source License

Declaration

private static NumberFormat getSizeFormat() 

Method Source Code

//package com.java2s;

import java.text.NumberFormat;

public class Main {
    private static ThreadLocal<NumberFormat> sNumberFormat = new ThreadLocal<NumberFormat>() {
        protected NumberFormat initialValue() {
            NumberFormat format = NumberFormat.getNumberInstance();
            // TODO: Consider making this locale/platform specific, OR a method parameter...
            //            format.setMaximumFractionDigits(2);
            format.setMaximumFractionDigits(0);
            return format;
        }/*from   w w w . j  a  v  a 2 s  .co  m*/
    };

    private static NumberFormat getSizeFormat() {
        return sNumberFormat.get();
    }
}

Related

  1. getFormattedSize(long size)
  2. getReadableByteSize(long size)
  3. getReadableSize(long size)
  4. getSize(long octets)
  5. getSizeAll(final long bytes)
  6. getSizeInKB(String size)
  7. getSizeString(long bytes)
  8. getSizeString(long number, Locale locale)
  9. getSizeString(long size)