How do you make a method “parse” to parse a String into a linked list of BigInte
ID: 3750060 • Letter: H
Question
How do you make a method “parse” to parse a String into a linked list of BigIntegers in java.Note: We are assuming that we need to make this linked list to cover integers larger than any current java types, so converting to Long is not an option. How do you make a method “parse” to parse a String into a linked list of BigIntegers in java.
Note: We are assuming that we need to make this linked list to cover integers larger than any current java types, so converting to Long is not an option. How do you make a method “parse” to parse a String into a linked list of BigIntegers in java.
Note: We are assuming that we need to make this linked list to cover integers larger than any current java types, so converting to Long is not an option.
Note: We are assuming that we need to make this linked list to cover integers larger than any current java types, so converting to Long is not an option.
Explanation / Answer
Parse a String into a linked list of BigIntegers in java using Constructor.
BigInteger(String value)
Translates the decimal String representation of a BigInteger into a BigInteger.
You need to download gwt-math-2.1.jar and import java.math.BigInteger to your program.
If you type any long number e.g. 484321036854714545416 it will not give any NumberFormatException. If you use BigInteger.valueOf(long) then it will give NumberFormatException error.
Thank You !
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.