| | |
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 |
account android api applet application array arrays automation bidirectional binary birt bluetooth class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program project property recursion ria scanner search server set sharepoint smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree unlimited webservices windows






