class Formats {

	public static String toSizeUnit(Long size) {
		if (size == null) {
			return "NaN";
		}
		if (size < KB_SIZE) {
			return size.toString();
		}

		if (size < MB_SIZE) {
			return (size / KB_SIZE) + "k";
		}

		if (size < GB_SIZE) {
			return (size / MB_SIZE) + "m";
		}

		if (size < TB_SIZE) {
			return (size / GB_SIZE) + "g";
		}

		return (size / TB_SIZE) + "t";
	}

}