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

  • SEARCH
  • Home
  • 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 8217397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:27:16+00:00 2026-06-07T12:27:16+00:00

I read Why is the range of bytes -128 to 127 in Java? it

  • 0

I read
Why is the range of bytes -128 to 127 in Java?
it says

128 is 10000000. Inverted, it’s 01111111, and adding one gets
10000000 again

so it concludes -128 is 10000000

so +128 cannot be represented in 2’s complement in 8 bits, but that means we can represent it in 9 bits, so 128 is 010000000 and so taking its 2’s complement -128 is 110000000,

so is representation of -128 10000000 or 110000000 ?
Is the representaion bit dependent ?

Why not simply make the lower range -127 fot 8 bits instead of writing -128 as 10000000 ?

  • 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-06-07T12:27:18+00:00Added an answer on June 7, 2026 at 12:27 pm

    Why is the range of unsigned byte is from -128 to 127?

    It’s not. An unsigned byte (assuming 8-bit) is from 0 to 255.

    The range of a signed byte using 2’s complement is from -128 to 127, directly from the definition of 2’s complement:

    01111111 = +127
    01111110 = +126
    01111101 = +125
    ...
    00000001 = +1
    00000000 =  0
    11111111 = -1
    ...
    10000010 = -126
    10000001 = -127
    10000000 = -128
    

    so is representation of -128 10000000 or 110000000 ?

    In 8-bit, it’s 10000000, in a hypothetical 9-bit representation it’s 110000000.

    Why not simply make the lower range -127 for 8 bits?

    Artificially restricting the range to -127 wouldn’t achieve very much; you’d be disallowing a perfectly valid value, and generally making code more complex (what else would you do with the bit pattern 10000000?).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In 2 complements I read from wikipedia, the range is from -128 to 127.
How can I read a file to bytes in Java? It is important to
I am trying to read a range into a data.frame from a xlsm workbook.
Suppose I have range from E2 to E16. How do I read values from
Im trying to get this remote binary file to read the bytes, which (of
Is there a way to read a small int (i.e. 1-byte int of range
As the title says, I need to write a small program to read data
I use range hader, but not create correct file. if I send Range bytes=0-8999
I am trying to read a file with ip/mask ranges and if the supplied
I get a strange error message when trying to read non-ascii from the datastore:

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.