Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Date;

public class Main {
    public static int milli2int(long milli) {
        Date date = new Date(milli);
        int total = 0;
        int year = date.getYear() - 112;
        int month = date.getMonth() + 1;
        int day = date.getDate();
        int hour = date.getHours();
        int minute = date.getMinutes();
        int sec = date.getSeconds();
        total = year << 26;
        total |= month << 22;
        total |= day << 17;
        total |= hour << 12;
        total |= minute << 6;
        total |= sec;
        return total;
    }
}