Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static long intID() {
        Calendar c = Calendar.getInstance();

        int dia = c.get(Calendar.DAY_OF_MONTH);
        int ano = c.get(Calendar.YEAR) - 2010;
        int mes = c.get(Calendar.MONTH) + 1;

        int hora = c.get(Calendar.HOUR_OF_DAY);
        int minuto = c.get(Calendar.MINUTE);
        int segundo = c.get(Calendar.SECOND);
        int milisec = c.get(Calendar.MILLISECOND);

        return Long.parseLong("" + ano + mes + dia + hora + minuto + segundo + milisec);
    }
}