标签:dff public 根据 排序 range 结束 sys fill 二维数组
1.定义数组
String [] a;
String [] a=new int[5];
int a[]=new int[5];
public class text { public static void main(String[] args) { String[] a = new String[] { "avfg", "bcd", "4s", "de", "1d1", "2dff2", "4gsd4", "4sdfs1", "14", "sdf" }; String b = "1d1"; Boolean d = false; for (String c : a) { if (c.equals(b)) { d = true; } } System.out.println(d); /*这个是二分法 * Arrays.sort(a); 先排序...必要!!!! * int c = Arrays.binarySearch(a, "1d1");然后在查看有没有! * System.out.println(c);输出值大于等于0证明有,为负则没有!! */ } }
标签:dff public 根据 排序 range 结束 sys fill 二维数组
原文地址:http://www.cnblogs.com/zhangxin4477/p/7478482.html