Java tutorial
//package com.java2s; public class Main { private static String[] get24HourArray() { final int SIZE = 24; String[] hour = new String[SIZE]; int index; for (index = 0; index < SIZE; index++) { String indexValue = String.valueOf(index); if (indexValue.length() == 1) { indexValue = String.format("0%s", indexValue); } hour[index] = indexValue; } return hour; } }