Java Boolean to Int booleanToInteger(boolean b)

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

Description

Converts a boolean into an integer.

License

Open Source License

Parameter

Parameter Description
b The boolean to be converted

Return

The integer output

Declaration

public static int booleanToInteger(boolean b) 

Method Source Code

//package com.java2s;
/*/*from w w w  . j  av a  2 s.c o m*/
 * Copyright (c) 2014 mgamelabs
 * To see our full license terms, please visit https://github.com/mgamelabs/mengine/blob/master/LICENSE.md
 * All rights reserved.
 */

public class Main {
    /**
     * Converts a boolean into an integer.
     * This is necessary for some OpenGL interactions
     *
     * @param b The boolean to be converted
     * @return The integer output
     */
    public static int booleanToInteger(boolean b) {
        if (b)
            return 1;
        else
            return 0;
    }
}

Related

  1. boolean2int(String tmp)
  2. booleanToInt(boolean[] values)
  3. booleanToint(final boolean value)
  4. BooleanToInteger(boolean thisbool)
  5. boolToInt(boolean b)
  6. boolToInt(boolean b)
  7. boolToInt(boolean bool)