`java.lang.NumberFormatException` in StreamCipher - Key Parsing Issue
Why am I encountering a
java.lang.NumberFormatException
in my Java StreamCipher
program for a simple stream cipher task? Could someone point me in the right direction? The error occurs when I try to parse the key from the command line arguments using Integer.parseInt()
. Specifically, the error message says "For input string: "4294966017"".
Here's the relevant snippet from my StreamCipher.java
main
method:
7 Replies
⌛
This post has been reserved for your question.
Hey @dghf! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
However, when I run this, I get the following error:
try parse long
instead of int
So I should change it from
seed = Integer.parseInt(key);
to seed = Long.parseLong(key);
?
I got
after switching to Long.parseLong(key);
Oh sorry, I forgot to compile!
Is this good?if it doesnt throw any error then i guess it works
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.