架构理念:[简单][高效][可依赖] 管理理念:[价值][勇气][专注]

IdConvertor

import java.sql.Timestamp;

public class IdConvertor {

    public static void main(String[] args) {
        // ID 转时锟斤拷
    //your ID
    long id = 500000000002416047L;
    id = id % 10000000000000000L;
    id = id / 1000L;
    id = id >> 5L;
    id += 1542335205801L;
    System.out.println(new Timestamp(id));

        // 时锟斤拷转 ID

          long xxx = System.currentTimeMillis();
      xxx -= 1542335205801L;
      xxx = (xxx << 5L) | 31L; // 锟斤拷小 0锟斤拷锟斤拷锟 31
     xxx = xxx * 1000 + 999; // 锟斤拷小 0锟斤拷 锟斤拷锟 999
     xxx =150000000000000000L + xxx;
     System.out.println(xxx);

    }
}

 

posted @ 2022-06-30 20:19  文和-Mignet  阅读(46)  评论(0编辑  收藏  举报