Java Boolean to Int boolToInt(boolean bool)

Here you can find the source of boolToInt(boolean bool)

Description

Converts a boolean to its integer value.

License

Open Source License

Parameter

Parameter Description
bool a bool, the one to be converted to an int

Return

an int, 1 denoting true and -1 denoting false

Declaration

public static int boolToInt(boolean bool) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*www  .j  ava  2 s  .c o m*/
     * Converts a boolean to its integer value.
     *
     * @param bool
     *            a bool, the one to be converted to an int
     * @return an int, 1 denoting true and -1 denoting false
     */
    public static int boolToInt(boolean bool) {
        if (bool) {
            return 1;
        }
        return -1;
    }
}

Related

  1. booleanToint(final boolean value)
  2. booleanToInteger(boolean b)
  3. BooleanToInteger(boolean thisbool)
  4. boolToInt(boolean b)
  5. boolToInt(boolean b)
  6. BoolToInt(boolean Expression)
  7. boolToInt(Boolean[] bools_in)
  8. convertBooleanToInt(boolean aValue)
  9. convertBooleanToInt(boolean bool)