Java tutorial
//package com.java2s; public class Main { private static final String COLON = ":"; public static int[] extractTimeDetailsFromString(String value) { int hour = Integer.parseInt(value.substring(0, value.indexOf(COLON))); int min = Integer.parseInt(value.substring(value.indexOf(COLON) + 1, value.length())); return new int[] { hour, min }; } }