protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; } }
protected String formatSize(long size, String format) { String retString = ""; if (format.equalsIgnoreCase("bytes")) { DecimalFormat decimalFormat = new DecimalFormat("#,##0"); retString = decimalFormat.format(size); } else { if (size < 0) { retString = "-1k"; } else if (size == 0) { retString = "0k"; } else if (size < ONE_KILOBYTE) { retString = "1k"; } else if (size < ONE_MEGABYTE) { retString = Long.toString((size + 512) / ONE_KILOBYTE); retString += "k"; } else if (size < 99 * ONE_MEGABYTE) { DecimalFormat decimalFormat = new DecimalFormat("0.0M"); retString = decimalFormat.format(size / (double)ONE_MEGABYTE); } else { retString = Long.toString((size + (529 * ONE_KILOBYTE)) / ONE_MEGABYTE); retString += "M"; } retString = padLeft(retString, 5); } return retString; }