Ask Question Sign In Sign Up
Home
Sign In
Sign Up
  • Home
  • >
  • Java
  • >
  • Convert Boolean into Int in Java
PHP JavaScript C/C++ Golang Java Python SQL Ruby Kotlin Swift Other
Category
PHP
JavaScript
C/C++
Golang
Java
Python
SQL
Ruby
Kotlin
Swift
Other

Convert Boolean into Int in Java

Member

lou_lindgren

by lou_lindgren , in category: Java , a year 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

Related Threads:

Spent a lot of time to understand this logic in Python

How to return boolean result in Java

Design Product Table in SQL when you don't know how is foreign keys works in SQL

Parse Command method in real project on the Java

How to get difference between dates in Java

Do not check for int type like this in PHP

About us

  • Contact us
© 2023 Copyright: crapcodes.com

This Site is Created By mywebforum.com

Get Your Own Questions & Answers platform