Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static int convertT9CharToIndex(char c) {
        if ((c >= '0') && (c <= '9')) {
            return c - '0';
        }

        switch (c) {
        case '+':
            return 10;
        case ',':
            return 11;
        case '*':
            return 12;
        case '#':
            return 13;
        default:
            throw new IllegalArgumentException("INVALID T9 SEARCH CHARACTER");
        }
    }
}