Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Calendar;

public class Main {
    public static ArrayList<Calendar> formatTimesForObject(String string) {
        ArrayList<Calendar> times = new ArrayList<>();
        for (String s : string.split(" ")) {
            int hour = Integer.valueOf(s.split(":")[0]);
            int minute = Integer.valueOf(s.split(":")[1]);

            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.HOUR_OF_DAY, hour);
            calendar.set(Calendar.MINUTE, minute);
            times.add(calendar);
        }
        return times;
    }
}