Logical indexing in JAVA

Viewed 700

How to do access array elements using logical indexing in Java?

Matlab/Octave equivalent of what I want to do:

A = [1 2 3 4 5 6]
logicalarray=[0 1 0 0 0 1];
result= A(logical)

which gives result =[2 6]

If I have the same A and logicalarray in Java. How would I get that result without using loops?

2 Answers
Related