Your I/O is eccentric.
args[0]
, args[2]
, and args[4]
are ignored. args[5]
is also required, but the program never does anything with it.
Code in main()
should be kept to a minimum — just enough to process the arguments. There should be another method, such as public static BigDecimal e(int precision, int threads)
that does the "real" work, so that your class can be called by other code in the future.
Hard-coding result.txt
is user-unfriendly and limits the reusability of your code. I suggest printing your diagnostics to System.err
and the output to System.out
. Let the user redirect System.out
to a file using the shell, if desired. Your program shouldn't have to worry about such things.
The thread-spawning code really ought to be generalized. There should be an array of Thread
s rather than a large number of Thread
variables.
Calculating factorial()
from scratch is wasted work. You should be able to compute factorials based on factorials computed in previous terms.
Consider other algorithms other algorithms for calculating e.
Your I/O is eccentric.
args[0]
, args[2]
, and args[4]
are ignored. args[5]
is also required, but the program never does anything with it.
Code in main()
should be kept to a minimum — just enough to process the arguments. There should be another method, such as public static BigDecimal e(int precision, int threads)
that does the "real" work, so that your class can be called by other code in the future.
Hard-coding result.txt
is user-unfriendly and limits the reusability of your code. I suggest printing your diagnostics to System.err
and the output to System.out
. Let the user redirect System.out
to a file using the shell, if desired. Your program shouldn't have to worry about such things.
The thread-spawning code really ought to be generalized. There should be an array of Thread
s rather than a large number of Thread
variables.
Calculating factorial()
from scratch is wasted work. You should be able to compute factorials based on factorials computed in previous terms.
Consider other algorithms for calculating e.
Your I/O is eccentric.
args[0]
, args[2]
, and args[4]
are ignored. args[5]
is also required, but the program never does anything with it.
Code in main()
should be kept to a minimum — just enough to process the arguments. There should be another method, such as public static BigDecimal e(int precision, int threads)
that does the "real" work, so that your class can be called by other code in the future.
Hard-coding result.txt
is user-unfriendly and limits the reusability of your code. I suggest printing your diagnostics to System.err
and the output to System.out
. Let the user redirect System.out
to a file using the shell, if desired. Your program shouldn't have to worry about such things.
The thread-spawning code really ought to be generalized. There should be an array of Thread
s rather than a large number of Thread
variables.
Calculating factorial()
from scratch is wasted work. You should be able to compute factorials based on factorials computed in previous terms.
Consider other algorithms for calculating e.
Your I/O is eccentric.
args[0]
, args[2]
, and args[4]
are ignored. args[5]
is also required, but the program never does anything with it.
Code in main()
should be kept to a minimum — just enough to process the arguments. There should be another method, such as public static BigDecimal e(int precision, int threads)
that does the "real" work, so that your class can be called by other code in the future.
Hard-coding result.txt
is user-unfriendly and limits the reusability of your code. I suggest printing your diagnostics to System.err
and the output to System.out
. Let the user redirect System.out
to a file using the shell, if desired. Your program shouldn't have to worry about such things.
The thread-spawning code really ought to be generalized. There should be an array of Thread
s rather than a large number of Thread
variables.
Calculating factorial()
from scratch is wasted work. You should be able to compute factorials based on factorials computed in previous terms.
Consider other algorithms for calculating e.