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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:32:56+00:00 2026-06-14T01:32:56+00:00

I’m developing an app based on the BluetoothChat sample code. I need to be

  • 0

I’m developing an app based on the BluetoothChat sample code. I need to be able to write a byte array containing hex values to the output stream. I also need to parse through the byte array on the inputstream and read the hex values. Here’s my code just to simply write hex values to the byte array

byte[] data = new byte [3];
data[0] = (byte) 0x53;
data[1] = (byte) 0x1C;
data[2] = (byte) 0X06;

However, when stepping through debug and watching “data”, the debugger shows the values as data[0]=83, data[1]=28, data[2]=6. Why are all the values converted to ascii? The same thing is happening when I watch byte[] buffer when reading the inputstream.

 // Read from the InputStream
 bytes = mmInStream.read(buffer);

I sent a byte array containing hex values, but byte[] buffer is showing ascii values. How can I read and write the raw hex values over bluetooth? Some of the read/write streams will be short <15byte stream for commands. But I’ll also need to read a large file encoded as hex bytes. Any suggestions for that input stream? Do I need to use BufferedInputStream?

  • 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-14T01:32:58+00:00Added an answer on June 14, 2026 at 1:32 am

    When you write

    int answer = 42;
    System.out.println(answer);
    

    The int value stored in the answer variable is converted to a String and then displayed on your monitor. The same applies to displaying the value in your IDE’s debugger. Eventually, all numerical data is converted to ASCII (or some other character encoding) in order to display it. This is true in any programming language.

    Now we might wonder how does this conversion occur. By default, the int value is converted to its decimal representation. This is what most humans are used to reading and expect to see. As programmers, we sometimes need to think of the hexadecimal representation of an int value, such as you are doing in your code. However, the computer does not automatically know this just because we set the value of a variable using a hexadecimal representation. In particular, your IDE still defaults to displaying all int data in its decimal representation.

    Fortunately, IDE designers are programmers and realize that we sometimes need to see int data in a different form. You can change the setting for your debugger to display int data as hexadecimal. Since the steps to do this depends on your IDE, you should check the help files for details.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am confused How to use looping for Json response Array in another Array.
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an array which has BIG numbers and small numbers in it. I

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.