Java Boolean Convert to booleanToTinyInt(boolean b)

Here you can find the source of booleanToTinyInt(boolean b)

Description

MySQL boolean to tinyint.

License

Open Source License

Parameter

Parameter Description
b boolean

Return

tiny int value

Declaration

public static int booleanToTinyInt(boolean b) 

Method Source Code

//package com.java2s;
/*/*  www.  j ava2s.  c om*/
 *   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 3 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 {
    /**
     * MySQL boolean to tinyint.
     *
     * @param b   boolean
     * @return   tiny int value
     */
    public static int booleanToTinyInt(boolean b) {
        if (b) {
            return (1);
        } else {
            return (0);
        }
    }
}

Related

  1. booleanArrayToString(boolean[] b, String delim)
  2. booleanArrayToString(boolean[] ba)
  3. booleanToBasicType(boolean b, Class clazz)
  4. booleanToDouble(boolean b)
  5. booleanToStr(boolean bool)
  6. booleanToYesNo(Boolean b)
  7. boolToNum(Boolean bool)
  8. BoolToNum(boolean bool)
  9. boolToNumber(boolean aBoolean)