第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何檢查給定的字符串轉(zhuǎn)換為 long 是否是 EpochMills?

如何檢查給定的字符串轉(zhuǎn)換為 long 是否是 EpochMills?

Helenr 2023-05-10 14:25:01
您好有什么方法可以檢查給定的字符串是否是 epoch millisjava.time 包中的以下代碼轉(zhuǎn)換為 EpochMillis。我正在尋找 isEpochMillis 以返回布爾條件。是否有來(lái)自 apache commons 或 google guava 的現(xiàn)成的 api 來(lái)檢查這個(gè)?就像 isDouble isLong 等.../**     * Obtains an instance of {@code Instant} using milliseconds from the     * epoch of 1970-01-01T00:00:00Z.     * <p>     * The seconds and nanoseconds are extracted from the specified milliseconds.     *     * @param epochMilli  the number of milliseconds from 1970-01-01T00:00:00Z     * @return an instant, not null     * @throws DateTimeException if the instant exceeds the maximum or minimum instant     */    public static Instant ofEpochMilli(long epochMilli) {        long secs = Math.floorDiv(epochMilli, 1000);        int mos = (int)Math.floorMod(epochMilli, 1000);        return create(secs, mos * 1000_000);    }
查看完整描述

3 回答

?
有只小跳蛙

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超8個(gè)贊

任何正整數(shù)在理論上都是有效的。您可以根據(jù)自己對(duì)領(lǐng)域的了解添加約束。例如:未來(lái)沒(méi)有時(shí)間戳,因此所有大于 Instant.now().toEpochMillis() 的數(shù)字都是無(wú)效的。



查看完整回答
反對(duì) 回復(fù) 2023-05-10
?
慕田峪4524236

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超5個(gè)贊

沒(méi)有,但這是該方法的實(shí)現(xiàn):

public static boolean isEpochMillis(long epochMilli) { 
  return true; 
}

當(dāng)然,既然您看到了它的實(shí)現(xiàn),您可能會(huì)發(fā)現(xiàn)這個(gè)方法是不必要的。


查看完整回答
反對(duì) 回復(fù) 2023-05-10
?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個(gè)贊

epochMilli 是自 1970-01-01 以來(lái)的毫秒數(shù)。所有長(zhǎng)值都是有效的 epochMillis。歸結(jié)為您允許的日期。那將是你的范圍。

-2 將導(dǎo)致1969-12-31T23:59:59.998?Z。


查看完整回答
反對(duì) 回復(fù) 2023-05-10
  • 3 回答
  • 0 關(guān)注
  • 225 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)