Java-Android-Process time in IF statement (real time code)

Viewed 258

I have 2 codes snippets with the same condition:

boolean A =true;
boolean B =true;

very simple. But Which one of the 2 codes will be faster ,only in this case,not when one of them is false

first code:

  if(A&&B){
  doSomthing();
  }

second code:

if(A){
     if(B){
  doSomthing();
  }}

Remember: A and B are true.

I just modify and optimize my code that do real time rendering,and every millisecond could be big improvment in terms of very large arrays.

**I guess that if A=false, the second code will be faster. but if B=false the first will be faster?

more info: A and B in my case is just two conditions like:

(mNumber==5&&arr[j]!=19)

results after test it: with the conditions: A=true; and B=true; there is no really different between the 2 codes( mixing results in term of nano seconds-kind of equels results)

1 Answers
Related