Here you can find the source of TextToValue(char c)
public static int TextToValue(char c)
//package com.java2s; /*//from ww w .j a va 2 s. c o m * Copyright (c) 2014 Chris Welty. * * This is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 3, * as published by the Free Software Foundation. * * This file is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * For the license, see <http://www.gnu.org/licenses/gpl.html>. */ public class Main { public final static int WHITE = 0; public final static int EMPTY = 1; public final static int BLACK = 2; public static int TextToValue(char c) { switch (Character.toUpperCase(c)) { case 'O': case '0': case 'W': return WHITE; case '*': case 'X': case '+': case 'B': return BLACK; case '.': case '_': case '-': return EMPTY; default: throw new IllegalArgumentException("unknown character : " + c); } } }