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 7909393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:23:33+00:00 2026-06-03T12:23:33+00:00

I start with a signed byte array and convert to unsigned.. so is the

  • 0

I start with a signed byte array and convert to unsigned.. so is the printed result correct?

byte[] unsigned = new byte[] {10,100,120,180,200,220,240};
sbyte[] signed = Utils.toSignedByteArray(unsigned);

And the print (I just append them with a StringBuilder):

signed: [10,100,120,-76,-56,-36,-16]
unsigned : [10,100,120,180,200,220,240]

where:

public static sbyte[] toSignedByteArray(byte[] unsigned){
    sbyte[] signed = new sbyte[unsigned.Length];
    Buffer.BlockCopy(unsigned, 0, signed, 0, unsigned.Length);
    return signed;
}

If I change to this I get the same result.

sbyte[] signed = (sbyte[])(Array)unsigned;

Shouldn’t -128 (signed) become 0, -118 become 10, and so on.. and not 10 (signed) = 10 (unsigned)!?

Because
sbyte -128 to 127
byte 0 to 255

So??

  • 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-03T12:23:35+00:00Added an answer on June 3, 2026 at 12:23 pm

    Signed integers are represented in the Two’s complement system.

    Examples:

    Bits        Unsigned     2's complement
                value        value
    
    00000000    0            0
    00000001    1            1
    00000010    2            2
    01111110    126          126
    01111111    127          127
    10000000    128          −128
    10000001    129          −127
    10000010    130          −126
    11111110    254          −2
    11111111    255          −1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible for a signed Java Applet or Web Start app to write
Ramaze.start :port => 80 If my understanding is correct, the line above is a
I start a process in c# like this: Process p= new Process(); p.StartInfo.FileName =
I installed a self-signed certificate and restartet. Now i can't start the admin console
Problem I need to create 32 Bit numbers (signed or unsigned doesn't matter, the
I ask because I have an unsigned jar that runs and a signed version
I'm about to start a new project where an android client and a gwt
I'll start with the code: typedef std::vector<unsigned char> CharBuf; static const int RCV_BUF_SIZE =
Start with a series of MS Office extensions built in C++ as COM objects.
I start Firefox (Linux) via command line using a cron-job. When there is no

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.