Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.math.BigInteger;

public class Main {

    public static boolean isBetweenTimeStr(String time, String starttime, String endtime) {
        try {
            BigInteger timeInt = new BigInteger(time);
            BigInteger starttimeInt = new BigInteger(starttime);
            BigInteger endttimeInt = new BigInteger(endtime);
            int compareResult = timeInt.compareTo(starttimeInt);
            if (compareResult == -1) {
                return false;
            } else if (compareResult == 0) {
                return true;
            } else if (compareResult == 1) {
                compareResult = timeInt.compareTo(endttimeInt);
                if (compareResult >= 0) {
                    return false;
                } else {
                    return true;
                }
            }
            return false;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}