Hi Rajinder,
To see the result of change why don't you compile and run this piece of
Java code:

class Test {
   public static void main(String[] args){
     long start1, start2, time1, time2;
     boolean junk;
     start1 = System.currentTimeMillis();
     for (int i = 0; i < 1000; i++){
       if (Math.random() > 0.5){
         junk = true;
       } else {
         junk = false;
       }
     }
     time1 = System.currentTimeMillis() - start1;
     start2 = System.currentTimeMillis();
     for (int i = 0; i < 1000; i++){
       junk = Math.random() > 0.5;
     }
     time2 = System.currentTimeMillis() - start2;

     System.out.println("first: " + time1 + " second: " + time2);
   }
}

Run the program a couple of times and see for yourself.
Rajinder Sandhu wrote:

> can u tell me except redability,
> what else this modification has done ??
>
> From: Ashish [mailto:[EMAIL PROTECTED]]

> Couldn't help modifying this!
>
> Let us avoid
> if (someBooleanExpression) {
>         someVal = true;
> } else {
>         someVal = false;
> }
>
> try instead to write
> someVal = someBooleanExpression;
>


--
Ashish Shrestha
Gha 2-482, Balajutar, Kathmandu, Nepal
Phone: 977-1-350593.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to