| | |
Converting boolean to integer
Thread Solved
![]() |
•
•
Join Date: Dec 2004
Posts: 489
Reputation:
Solved Threads: 5
Does this help?
http://forum.java.sun.com/thread.jsp...sageID=1092147
http://forum.java.sun.com/thread.jsp...sageID=1092147
use:
or use function
java Syntax (Toggle Plain Text)
boolean b; int iSomeValue; b=true; if(iSomeValue==0)b=false;
java Syntax (Toggle Plain Text)
boolean intToBool(int iVal) { boolean b=true; if(iVal==0)b=false; return b; }
Last edited by DangerDev; Feb 14th, 2008 at 3:07 am. Reason: uncomlete
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Indian Developer
http://falaque.wordpress.com/
That is a lot more code than is needed. The conversion only needs the evaluation of intVal!=0, so the function reduces to
Java Syntax (Toggle Plain Text)
boolean intToBool(int value){ return (value != 0); }
![]() |
Similar Threads
- Weird Binary to Integer Problem (Java)
- converting python to java (Java)
Other Threads in the Java Forum
- Previous Thread: 2D Java Fireworks Explosion
- Next Thread: I need help making a button for my panel
| Thread Tools | Search this Thread |
addball android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) button card class classes client code collision columns component constructor crashcourse css database designadrawingapplicationusingjavajslider draw eclipse ee error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image integration intellij j2me java javaarraylist javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia jvm linux loan loop method migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle phone physics plazmic print problem program programming project radio scanner server service set sharepoint smart sms smsspam software sql subclass support swing textfield threads tree trolltech unlimited utility windows






