Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这段代码,它以(我想)字节显示分配的 JVM 内存:
Runtime.getRuntime().totalMemory()
当我打印输出时,我得到类似12232313131. 你能告诉我如何以兆字节和千兆字节打印它吗?
12232313131
一个不错的技巧是使用 printf(...);
System.out.printf("%.3fGiB", Runtime.getRuntime().totalMemory() / (1024.0 * 1024.0 * 1024.0));
List<Customer> customerList= new List<Customer>(); List<Employee> employeeList= new List<Employee>(); Fakes.ShimDataServiceRepository<object>.AllInstances.GetEnt