Java File Size Readable Format formatToolBarDisplay(String text, int size)

Here you can find the source of formatToolBarDisplay(String text, int size)

Description

format Tool Bar Display

License

Apache License

Declaration

public static String formatToolBarDisplay(String text, int size) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String formatToolBarDisplay(String text, int size) {
        if (text.equals("-1")) {
            text = "Mixed";
        }//from   w w  w  .  ja  v  a  2 s. c o  m
        int textSize = text.length();
        int rem = size - textSize;
        if (rem > 0) {
            int newSize = rem / 2;
            for (int i = 0; i < newSize; i++) {
                text = text + " ";
            }
            text = " " + text;
        }
        return text;
    }
}

Related

  1. formatSize(long v)
  2. formatSize(String strSize)
  3. formatSize(StringBuilder builder, Long size)
  4. formatSizeInBytes(int size)
  5. formatSpaceUsage(long size)
  6. getFileSizeInByte(File file)
  7. getFileSizeInBytes(File f)
  8. getFileSizeInMB(String fileName)
  9. getHumanSize(File dir)