ちょっと私は私のコードにこの関数を持っています:
public synchronized void finished()
{
howManyDone++;
log.append("Finished creating board "+this.howManyDone+"\n");
if(howManyDone == boards.length)
JOptionPane.showMessageDialog(log, "All Boards Were Created.","Attention",JOptionPane.WARNING_MESSAGE);
}
log.append コマンドに、evrey スレッドが 1 秒間に実行した量を追加したいと考えています。私はこれをやろうとしました:
public synchronized void finished()
{
long start = System.nanoTime();
howManyDone++;
long end = System.nanoTime();
long estTime = end - start;
double seconds = (double)estTime/1000000000;
}
そして、次のように毎回秒を出力します。
log.append("Finished creating board " +this.howManyDone+ " in "+seconds+"\n");
しかし、秒としてログに記録される数字は次のようになります: 6.00E-7 など... 何が間違っているのでしょうか?
ありがとう