Convert Boolean into Int in Java

Member

lou_lindgren

by lou_lindgren , in category: Java , 2 months ago

Convert Boolean into Int in Java


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
public static int booleanToInt(Boolean value) {
   int res;
   if (value == null) {
      res = 0;
   
   } else {
      if (value) {
         res = 1;
   } else {
         res = 0;
      }
   }
   
   return res;
}


Facebook Twitter LinkedIn Telegram Whatsapp Pocket

no answers