import java.util.Scanner;
public class Main {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String ip = in.nextLine();
String ziwang = in.nextLine();
String[] a = {“0″,”0″,”0″,”0”};
String[] b = {“0″,”0″,”0″,”0”};
String[] res = {“0″,”0″,”0″,”0”};
a[0] = ip.split(“.”)[0];
System.out.println(a[0]);
//int length = a.length;
//System.out.println(a[0]);

for(int i=0; i<4; i++) {
a[i] = ip.split(“.”)[i];
b[i] =ziwang.split(“.”)[i];
res[i] = Integer.toString(Integer.parseInt(a[i]) &Integer.parseInt(b[i]));
}
for(String m:res) {
System.out.println(m);
}

}

static String binary2decimal(int decNum , int digit) {
String binStr = “”;
for(int i= digit-1;i>=0;i–) {
binStr +=(decNum>>i)&1;
}
return binStr;
}

}

 有问题  Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

版权声明:本文为heartbeat111原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/heartbeat111/p/16398201.html