Can anyone help me to convert String to BigInteger. please
adil_bashir
-7
Junior Poster in Training
Recommended Answers
Jump to PostIn what way is the BigInteger constructor which accepts a string not working out for you?
Jump to PostConvert it to long first using Long.parseLong() and then convert the long to BigInteger using BigInteger.valueOf(long val)
This won't work if the string representation is outside the "long" data type range, which is one of the main motivation for using BigInteger...
thanks dear it worked, but isn't there any direct …
Jump to PostSo? It still doesn't change the fact that it will fail for certain inputs as mentioned above and the worst thing is that regular tests which don't exercise the limits won't be able to uncover this problem.
Please don't provide sub-standard advice to beginners who wouldn't know the difference …
All 10 Replies
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Philippe.Lahaie
commented:
the constructor that receives a char array was definitly the right answer all along ;)
+6
dantinkakkar
19
Junior Poster
adil_bashir
-7
Junior Poster in Training
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
dantinkakkar
19
Junior Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
dantinkakkar
19
Junior Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
dantinkakkar
19
Junior Poster
~s.o.s~
commented:
No worries
+17
adil_bashir
-7
Junior Poster in Training
Philippe.Lahaie
commented:
i disagree, being able to find answers on your own at your level is the best skill you can work on, if we hand you answers now, you will advanced to more advanced programming classes and find yourself on this forum asking for answers 24/7!
-1
ujjwale
commented:
yeah
+0
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.