Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static int parserString2TimeStamp(String str) {
        int totalSec = 0;
        if (str.contains(":")) {
            String[] my = str.split(":");
            int hour = Integer.parseInt(my[0]);
            int min = Integer.parseInt(my[1]);
            int sec = Integer.parseInt(my[2]);
            totalSec = hour * 3600 + min * 60 + sec;
            totalSec = totalSec * 1000;
        }
        return totalSec;
    }
}