开发者

Checking if long is in array

开发者 https://www.devze.com 2023-02-11 10:39 出处:网络
I need to make sure that a certain long value isn\'t in an array. But for some reason, this isn\'t working...

I need to make sure that a certain long value isn't in an array. But for some reason, this isn't working...

开发者_运维知识库
!d.toString().contains(sq.toString());

I am sure I am getting something really backwards... but I can't figure out what!


Try

!Arrays.asList(d).contains(sq);


Look at the static methods in java.util.Arrays. Your array will need to be sorted for the binarySearch() to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消