java - multiply large no. in array -
multiply 2 numbers. numbers can extremely large (i.e. run hundreds of digits) , provided strings.
the expected output string represents product of 2 numbers. example-
multiply("268435456","524288")="140737488355328" multiply("12321412423524534534543","0")="0"
use bigdecimal, has multiply method , constructor takes string
. contains corresponding tostring()
, toplainstring()
methods result string.
(if numbers whole numbers, use biginteger instead.)
Comments
Post a Comment