Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//  This code is licensed under the MIT License.

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    static final int TOKEN_EXPIRATION_IN_MINUTES = 60;

    static Date getValidExpiresOn() {
        return getExpirationDate(TOKEN_EXPIRATION_IN_MINUTES);
    }

    static Date getExpirationDate(int tokenExpiredDateInMinuite) {
        final Calendar expiredTime = new GregorianCalendar();
        // access token is only valid for a hour
        expiredTime.add(Calendar.MINUTE, tokenExpiredDateInMinuite);

        return expiredTime.getTime();
    }
}