Here you can find the source of formatTime(String time)
final static String formatTime(String time)
//package com.java2s; /**/*from w w w .ja v a2 s . co m*/ * @copyright Copyright (C) 2014-2016 City of Bloomington, Indiana. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt * @author W. Sibo <sibow@bloomington.in.gov> * */ public class Main { final static String formatTime(String time) { String ret = time; if (time.length() > 0 && time.indexOf(":") == -1) { if (time.length() == 4) { ret = time.substring(0, 2) + ":" + time.substring(2); } else if (time.length() == 3) { ret = "0" + time.substring(0, 1) + ":" + time.substring(1); } } return ret; } }