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 Calendar addDays(long time, int days) {
        return add(time, days, Calendar.DAY_OF_MONTH);
    }

    private static Calendar add(long time, int val, int field) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(time);

        if (field == 666) {
            c.add(Calendar.MONTH, val * 3);
        } else {
            c.add(field, val);
        }
        return c;
    }
}