get Short Day Of Week from int - Java java.util

Java examples for java.util:Week

Description

get Short Day Of Week from int

Demo Code

/**/*from   w  ww .  j  av  a 2 s  .c o m*/
 * Java
 *
 * Copyright 2014 IS2T. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be found at http://www.is2t.com/open-source-bsd-license/.
 */
//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        int dayOfWeek = 2;
        System.out.println(getShortDayOfWeek(dayOfWeek));
    }

    private static final String[] SHORT_DAYS_OF_WEEK = new String[] {
            "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };

    public static String getShortDayOfWeek(int dayOfWeek) {
        return SHORT_DAYS_OF_WEEK[dayOfWeek - 1];
    }
}

Related Tutorials