我正在创建临时目录
Files.createTempDirectory(String.format("project-it-screenshots-%d",
System.currentTimeMillis())).toFile();
我假设所有long
返回的 sSystem.currentTimeMillis()
具有相同的长度,因为具有不同长度的两个返回值必须来自不同的世纪。每天多次调用该方法后,我最终得到
project-it-screenshots-15343380422205011345585140911467
project-it-screenshots-15343381444485756307954062111474
project-it-screenshots-15343386111604255833362898885857
project-it-screenshots-15343388402055473274775132302475
project-it-screenshots-1534338974370463603854456850155
project-it-screenshots-15343390449093279576023746896269
project-it-screenshots-15343398036346426501075034038757
project-it-screenshots-15343399888498609875231360701639
project-it-screenshots-15343401211515574289310135012571
project-it-screenshots-15343405563586337945661543042110
project-it-screenshots-15343419027757787065954653813302
project-it-screenshots-15343425353682119990056938907868
project-it-screenshots-15343429571018010152043055630277
project-it-screenshots-15343431608662744493593200651167
project-it-screenshots-15343436122094379676346949668973
project-it-screenshots-15343442103124076542522856351947
project-it-screenshots-15343539846818150078805796257638
project-it-screenshots-15343555678106536264262565060437
project-it-screenshots-15343809068582300780873443756155
project-it-screenshots-15344378068483088975615680511653
project-it-screenshots-15344421866441533761733546877922
其中1534338974370463603854456850155
比其他数字短一位。这似乎与剥离前导0
s 无关,因为没有尾随0
s,因为一些长度较大的数字有它们,而其他数字没有。
我正在寻找解释,而不是解决方法(我将使用可以排序的格式化日期或将0
填充添加到String.format
仅略微更改时间戳的数字)。
我在 Ubuntu 18.04 上使用 OpenJDK 8。