Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getDayFromNumber(int day) {
        if (day < 0 || day > 30)
            throw new IllegalArgumentException();
        if (day <= 10)
            return String.valueOf(Character.toChars(1487 + day));
        else if ((day >= 11 && day <= 14) || (day >= 16 && day <= 19)) {
            char yod = Character.toChars(1497)[0];
            return String.valueOf(new char[] { yod, Character.toChars(1487 + (day - 10))[0] });
        } else if (day == 15 || day == 16) {
            char tet = Character.toChars(1498)[0];
            return String.valueOf(new char[] { tet, Character.toChars(1487 + (day - 9))[0] });
        } else if (day == 20) {
            return String.valueOf(Character.toChars(1499)[0]);
        } else if (day >= 21 && day <= 29) {
            char chaf = Character.toChars(1499)[0];
            return String.valueOf(chaf + Character.toChars(1487 + (day - 20))[0]);
        } else {
            return String.valueOf(Character.toChars(1500)[0]);
        }

    }
}