// 进制位
final static int JZ = 1024;
// 1KB
final static long KB = 1 * JZ;
// 1MB
final static long MB = KB * JZ;
// 1GB
final static long GB = MB * JZ;
// 1TB
final static long TB = GB * JZ;
// 1PB
final static long PB = TB * JZ;
// EB
final static long EB = PB * JZ;
// ZB(long 不能存储ZB字节)
// final static long ZB = EB * JZ;
public static void main(String[] args) {
System.out.println(KB);
System.out.println(MB);
System.out.println(GB);
System.out.println(TB);
System.out.println(PB);
System.out.println(EB);
// System.out.println(ZB);
System.out.println(Long.MAX_VALUE / EB);// 最大7EB
System.out.println(Long.MAX_VALUE);
final static int JZ = 1024;
// 1KB
final static long KB = 1 * JZ;
// 1MB
final static long MB = KB * JZ;
// 1GB
final static long GB = MB * JZ;
// 1TB
final static long TB = GB * JZ;
// 1PB
final static long PB = TB * JZ;
// EB
final static long EB = PB * JZ;
// ZB(long 不能存储ZB字节)
// final static long ZB = EB * JZ;
public static void main(String[] args) {
System.out.println(KB);
System.out.println(MB);
System.out.println(GB);
System.out.println(TB);
System.out.println(PB);
System.out.println(EB);
// System.out.println(ZB);
System.out.println(Long.MAX_VALUE / EB);// 最大7EB
System.out.println(Long.MAX_VALUE);
}

本文介绍计算机中常用的存储单位,从KB到EB,并演示了如何使用这些单位进行基本的转换。文章通过定义每个存储单位为前一个单位的1024倍来解释存储容量的增长,并给出了最大可表示值为7EB的示例。
2447

被折叠的 条评论
为什么被折叠?



