Here you can find the source of boolToInt(boolean bool)
Parameter | Description |
---|---|
bool | a bool, the one to be converted to an int |
public static int boolToInt(boolean bool)
//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; } }