Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static long startTime = 0; public static long endTime = 0; public static void setCurrentTime(boolean start) { Calendar calendar = Calendar.getInstance(); long time = calendar.getTimeInMillis(); if (start) startTime = time; else endTime = time; } }