我想分割句子轉化成的話, 看這是我的代碼:錯誤動作產生,當我嘗試當我嘗試拆分句子拿給我一個錯誤拆分句子
import java.io.*;
import java.util.*;
public class RunExe {
public static void main(String[] args) {
try
{
HashMap<String, String> map=new HashMap<String, String>();
ArrayList arrList=new ArrayList();
Process pr=Runtime.getRuntime().exec("VmgDiskActivityTest.exe");
BufferedReader rd=new BufferedReader(new InputStreamReader(pr.getInputStream()));
String lines=rd.readLine();
//String[] words=lines.split("=");
while(lines!=null)
{
String[] words=lines.split("=");
map.put(words[0], words[1]);
lines=rd.readLine();
}
Iterator it=map.entrySet().iterator();
while(it.hasNext())
{
Map.Entry str=(Map.Entry)it.next();
System.out.println("Keys :::"+str.getKey());
System.out.println("Values ::"+str.getValue());
String info=(String)str.getKey();
String values=(String)str.getValue();
String[] contentSplit=values.split("#");
for(String s : contentSplit)
{
//System.out.println(s);
arrList.add(Double.parseDouble(s));
}
}
Iterator it1=arrList.iterator();
while(it1.hasNext())
{
Double db=(Double)it.next();
System.out.println(db);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
當我嘗試執行上面的代碼告訴我像下面
Keys :::0 C: D: E:
Values ::99.094152#0.480072#0.499131#0.004801#0.000294#0.009792#0.000000#1.000080#4096.328080#17.001362#217105.388231
Exception in thread "main" java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:897)
at java.util.HashMap$EntryIterator.next(HashMap.java:934)
at java.util.HashMap$EntryIterator.next(HashMap.java:932)
at RunExe.main(RunExe.java:40)
Keys :::_Total
Values ::99.094152#0.480072#0.499131#0.004801#0.000294#0.009792#0.000000#1.000080#4096.328080#17.001362#217105.388231
我不能在我的代碼找到錯誤,能否請你告訴我上述問題的解決方案的錯誤。