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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:03:15+00:00 2026-06-02T11:03:15+00:00

I need to append some hexadecimal characters to my string. I’m trying this: content

  • 0

I need to append some hexadecimal characters to my string. I’m trying this:

content += Character.toString((char) Integer.parseInt(Integer.toHexString(originalSize).toString(), 16));

And it’s working, but when originalSize is over 127 (7F in hex) it returns me two hexadecimal values.

For example, doing this:

content += Character.toString((char) Integer.parseInt(Integer.toHexString(176).toString(), 16));

The result is: (content hex numbers) C0 B0

B0 is 176 in hexadecimal, but I don’t know how to remove C0. Any suggestions please? Thanks!

EDIT:

I want to send an string to a device via Bluetooth Low Energy. I have an string like this:

“ABCABC”. In hexadecimal is 41 42 43 41 42 43.

Now, I want to add the format of this string (because the device is waiting for it), so I add it at the end: 41 42 43 41 42 43 7E 06 02, where:

  • 7E: beggining of the format
  • 06: number of chars
  • 02: specifical format given by manufacturer.

I have the main string and I’m adding this three hexadecimal characters by hand.

SOLUTION:

Based on Devon_C_Miller answer I found my own solution:

contentFormated = new byte[originalSize+3];

for(int i=0;i<originalSize;i++){
    contentFormated[i] = content.getBytes()[i];
}

contentFormated[originalSize] = 0x7E;
contentFormated[originalSize+1] = (byte) 0xB0;
contentFormated[originalSize+2] = 0x02;
  • 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-02T11:03:17+00:00Added an answer on June 2, 2026 at 11:03 am

    It sounds like you want a byte array rather than a String:

    byte[] content = {0x42, 0x43, 0x41, 0x42, 0x43, 0x7E, 0x06, 0x02};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to append html content to a table some content that's returned from
i have some content in the div and i need to append some data
I need to append some text to an input field...
I'm creating some scripts to streamline application installations and I need to append to
I need to append log4j content to a Swing component (JTextArea or similar). Is
HTML is <a>ref</a> I need to get <a>ref</a>text How can i do this? $('a').append('text')
I need to append all elements in list_ to a string ; at the
Good day. I found the example below, I need to append some more text
I need to use appendChild() or jQuey's append() to append some <script> tag stuff
I need to create/append a text file and write some data in that. 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.