Boolean to Integer Java allows (explicit conversion) as well as implicit conversion of Boolean to these primitive data types int, long, double, or float.

package ch4_package;
import java.io.*;
public class Test_This {
public static void main(String[] args) throws IOException
{
// TODO Auto-generated method stub
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String str = "";
try{
System.out.println("---While Loop---");
System.out.print("Please enter your age: ");
str = br.readLine();
int n =Integer.parseInt(str);
int i=12 ;
int b, b1;
boolean max, senior;
max = (i <= n) ? true : false;
senior = max;
if (senior){
System.out.println("You are allowed in this ride: ");
b = (int) (senior ? 1: 0 );//explicit conversion
System.out.println("You are allowed in this ride: ");
b1 = (senior ? 1: 0 ); //implicit conversion
System.out.println("byte and integer used: "+ b + "\t" +b1);
}

else
{
System.out.print("sorry you cant' go in ths ride: ");
}
System.out.println();
}//try
catch(NumberFormatException e) { System.out.println("data was blank");}

}

}