Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3452692
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:17:17+00:00 2026-05-18T09:17:17+00:00

I have noticed java will not allow me to store large numbers such as

  • 0

I have noticed java will not allow me to store large numbers such as
2000000000, i.e 2 billion obviously to an integer type, but if I store the corresponding hex value i.e int largeHex = 0x77359400; this is fine,

So my program is going to need to increment up to 2^32, just over 4.2 billion, I tested out the hex key 0xffffffff and it allows me to store as type int in this form,

My problem is I have to pull a HEX string from the program.

Example

sT = "ffffffff";

int hexSt = Integer.valueOf(sT, 16).intValue();

this only works for smaller integer values

I get an error

Exception in thread "main" java.lang.NumberFormatException: For input string: "ffffffff"

All I need to do is have this value in an integer variable such as

int largeHex = 0xffffffff

which works fine?

I’m using integers because my program will need to generate many values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:17:17+00:00Added an answer on May 18, 2026 at 9:17 am

    Well, it seems there is nothing to add to the answers, but it’s worth it to clarify:

    • It throws an exception on parsing, because ffffffff is too big for an integer. Consider Integer.parseInt(""+Long.MAX_VALUE);, without using hex representation. The same exception is thrown here.
    • int i = 0xffffffff; sets i to -1.
    • If you already decided to use longs instead of ints, note that long l = 0xffffffff; will set l to -1 as well, since 0xffffffff is treated as an int. The correct form is long l = 0xffffffffL;.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have noticed that my particular instance of Trac is not running quickly and
I have noticed jQuery (or is it Firefox) will turn some of my <span
I have noticed that while using the Substance UI for Java that when I
I have noticed that cURL in PHP returns different data when told to output
I have noticed that some apps like Safari and Mail show a loading indicator
I have noticed that regardless of a given script's execution time, every date() call
I have noticed in phpMyAdmin you can click 'optimise' on tables, and it runs:
I have noticed that my geocoder is inconsistent in the code shown below because
I have noticed over the years that different developers have different criteria for what
I have noticed that both IE6 and IE7 push the parent div down when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.