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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:07:11+00:00 2026-06-02T20:07:11+00:00

I have got the String MacAddress, which i need to convert in to a

  • 0

I have got the String MacAddress, which i need to convert in to a byte array. Java wouldn’t let me do a direct conversion throwing a numberformat exception. This is what I’m doing right now

clientMac[0] = (byte)Integer.parseInt(strCameraMacId.substring(0, 2));

I tried doing it step by step

String mc = strCameraMacId.substring(0,2);
        int test = Integer.parseInt(mc);
        clientMac[0] = (byte) test;

But the String mc consists of a value “08” and after doing the int to byte converion im losing the zero.
the mac address im trying to convert is “08-00-23-91-06-48” and I might end up losing all the zeros. will I? and has anyone got an idea regarding how to approach this issue?

Thanks a lot

  • 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-02T20:07:13+00:00Added an answer on June 2, 2026 at 8:07 pm

    The zero is going to be implied in the byte value. Remember that 0x08 == 8. You should be able to convert your to an array of 6 bytes. Youre approach is fine, just remember that if you are going to convert this back to a string, that you need to let Java know that you want to pad each number back to 2 chars. That will put your implied zeros back in place.

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

Sidebar

Related Questions

I need to truncate string and rewrite it back to array I have got
I have got a function which is use to take a string and convert
I have got a date string which looks like the following: Thu Feb 09
I have got a std::list< std::pair<std::string,double> > , which I know is sorted according
I have got a problem with types conversion in C# (VS2010). I need to
I have got the following objective-c code which does what I need to do
I have got a string, say, 5+30 and I need to parse it to
I have got the XML below, which is stored in string type variable, and
I have got a string in the form: 8 AM;10:15 AM;3:30 PM;6:15 PM which
I have got a string which is maybe date = 10/08/2011; English time style.

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.