我是一个新手编码器,需要一些帮助。我试图根据与我可以使用多少位数相对应的数字将数字的数字相加。我使用Eclipse Juno并使用单独的文本文件来使用我的数字。虽然没有太多这是我现在有:用指引添加数字列表中的数字
public static void main(String[] args) throws IOException{
String token1 = "";
Scanner infile1 = new Scanner(new File("input.txt"));
ArrayList<String> temps = new ArrayList<String>();
//Adding Input files to the Arraylist
while(infile1.hasNext()){
token1 = infile1.next();
temps.add(token1);
}
infile1.close();
//Calling the Numbers from ArrrayList temps
for(int x = 0; x < temps.size(); x++) {
System.out.println(x + " " + temps.get(x));
for(x = 0; x < temps.size(); x++){
}
}
}
}
的数字是 9678415 7, 9678415 6, 9678415 5, 9678415 4, 2678515 3, 数量增加,位数使用。 input.txt文件没有逗号
我忘了提及返回最高数字值 – LittleRising
你想要做什么的描述不清楚。请显示输入的示例以及预期的输出。 – AdrianHHH
示例输出应该是986541,987641,98765,9876和875 – LittleRising