Here you can find the source of convertMinutesSecondsToMilliseconds(String offset)
static public int convertMinutesSecondsToMilliseconds(String offset) throws NumberFormatException
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**//from w ww .j a v a 2 s .c o m * Given a string of the form mm:ss, returns the total milliseconds */ static public int convertMinutesSecondsToMilliseconds(String offset) throws NumberFormatException { boolean isOK = true; StringTokenizer tokenizer = new StringTokenizer(offset, ":"); String token = null; int first = -1; int second = -1; try { token = tokenizer.nextToken(); } catch (NoSuchElementException e) { isOK = false; } try { first = Integer.parseInt(token); } catch (NumberFormatException e) { isOK = false; } try { token = tokenizer.nextToken(); } catch (NoSuchElementException e) { isOK = false; } try { second = Integer.parseInt(token); } catch (NumberFormatException e) { isOK = false; } if (!isOK) { throw new NumberFormatException(); } return ((first * 60000) + (second * 1000)); } }