I have an operation to make in java which I cannot find a way around without doing a for loop which I really want to avoid for computation efficiency. I used to program in Matlab and its pretty easy to do it, but in java seems a lot more tricky. My question is this... What would be the java equivalent of this Matlab code:
A = [1;-3;2;2;5-7;0];
A<1;
ans =
0
1
0
0
1
1
in java I tried this method while roaming the internet.
Integer[] array = {-1,2,-3,4,-5,-6};
List<Integer> result = Arrays.stream(array).filter(w -> w < 1 )
.collect(Collectors.toList());
In this example result = {-1,-3,-5,-6}
and but I wish to have result = {1,0,1,0,1,1}