String time = "12:34";
Pattern p = Pattern.compile("^([01][0-9]|2[0-3]):([0-5][0-9])$");
Matcher m = p.matcher(time);
if(m.find()){
System.out.println("HH:" + m.group(1));
System.out.println("mm:" + m.group(2));
System.out.println("HH:mm:" + m.group());
}