所以我有3名數組列表和它們都具有相同的尺寸,我想將它們打印在一個Excel文件,但工作在IP和GEO只在返回的第一個值並結束。使用多個陣列嵌套循環列出
這是我的代碼:
for (String url : IPGrabber.URLArray) {
Row row = sheet.createRow(rownum++);
row.createCell(0).setCellValue(url);
for (String ip : IPGrabber.IPArray) {
row.createCell(1).setCellValue(ip);
}
for (String geo : GEOLookup.GEOArray) {
row.createCell(2).setCellValue(geo);
}
}
這是Excel
http://www.google.com 199.59.148.82 United States
http://www.google.com 199.59.148.82 United States
http://www.mcbay.net 199.59.148.82 United States
http://www.facebook.com 199.59.148.82 United States
http://twitter.com 199.59.148.82 United States
輸出正如你可以看到URLArray和IPArray是repeatign相同的值
任何幫助將是很大的讚賞嘗試了許多不同的方法。
工作完美!謝謝 :) – TehBawz