Java Memory Free formatMemorySize(Long afreeDiskSpace)

Here you can find the source of formatMemorySize(Long afreeDiskSpace)

Description

format Memory Size

License

Open Source License

Declaration

public static String formatMemorySize(Long afreeDiskSpace) 

Method Source Code

//package com.java2s;

public class Main {
    private static Long freeDiskSpace;

    public static String formatMemorySize(Long afreeDiskSpace) {
        freeDiskSpace = afreeDiskSpace;/*  w ww.j ava  2 s .c  o  m*/
        if (afreeDiskSpace < 1024) {
            return "Free Disk Space: " + afreeDiskSpace + "B";
        } else if (afreeDiskSpace < 1048576) {
            return "Free Disk Space: " + afreeDiskSpace / 1024 + "KB";
        } else if (afreeDiskSpace < 1073741824) {
            return "Free Disk Space: " + afreeDiskSpace / 1048576 + "MB";
        } else {
            return "Free Disk Space: " + afreeDiskSpace / 1073741824 + "GB";
        }
    }
}

Related

  1. belowMemoryLimit(int percentFree)
  2. checkFreeMemory(long requiredMemory)
  3. freeAllocatedMemory()
  4. freeMemory()
  5. freeMemory()
  6. freeMemory()