Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.Log;
import java.util.Calendar;

public class Main {
    private static boolean isBefore(Calendar date, String time) {
        try {
            String[] arr = time.split(":");
            int hours = Integer.parseInt(arr[0]);
            int mins = Integer.parseInt(arr[1]);
            return (date.get(Calendar.HOUR_OF_DAY) < hours)
                    || (date.get(Calendar.HOUR_OF_DAY) == hours && date.get(Calendar.MINUTE) < mins);
        } catch (Exception e) {
            Log.e("Utils.java isBefore",
                    "The supplied times are not properly formatted. Verify that your schedule times follow the hh:mm pattern");
            return true;
        }
    }
}