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

I have 2 code snippets with the same condition:

boolean A =true;
boolean B =true;

very simple. But which of the two codes will be faster, only in this case, if none 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 performs real-time rendering, and every millisecond can be greatly improved in terms of very large arrays.

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

Additional information: A and B in my case are just two conditions:

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

: : A = true; B = true; ( nano- )

+4
1

, , . " " , , , ; , , , .

if(a & b) , . ( , , . , a && b.)

: , , & &&. - , , boolean, AND .

+2

All Articles