Java Number to Boolean numberToBool(byte aNumber)

Here you can find the source of numberToBool(byte aNumber)

Description

Converts a number to a boolean, according to the lobby protocol standard.

License

Open Source License

Parameter

Parameter Description
aNumber to be converted into a boolean

Return

true if aNumber == 1, false otherwise

Declaration

public static boolean numberToBool(byte aNumber) 

Method Source Code

//package com.java2s;
/*// w  w  w .ja v a2  s.c  om
   Copyright (c) 2011 Robin Vobruba <hoijui.quaero@gmail.com>
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
    
   This program 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.
    
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

public class Main {
    /**
     * Converts a number to a boolean, according to the lobby protocol standard.
     * @param aNumber to be converted into a boolean
     * @return <tt>true</tt> if <tt>aNumber == 1</tt>, <tt>false</tt> otherwise
     * @see #boolToNumber(boolean)
     */
    public static boolean numberToBool(byte aNumber) {
        return (aNumber == 1);
    }
}

Related

  1. NumberToboolean(final Number value)