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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:05:41+00:00 2026-05-15T11:05:41+00:00

For a project, I have to convert a binary string into (an array of)

  • 0

For a project, I have to convert a binary string into (an array of) bytes and write it out to a file in binary.

Say that I have a sentence converted into a code string using a huffman encoding. For example, if the sentence was: “hello” h = 00 e = 01, l = 10, o = 11

Then the string representation would be 0001101011.

How would I convert that into a byte? <– If that question doesn’t make sense it’s because I know little about bits/byte bitwise shifting and all that has to do with manipulating 1’s and 0’s.

  • 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-05-15T11:05:41+00:00Added an answer on May 15, 2026 at 11:05 am

    If you really want (or have to) creating a string representation of bits, you could split the string in substrings of length 8 (beware of the last one which is not necessarily of length 8).

    Integer
    has a method to parse string representations, a sequence of ‘0’ and ‘1’s can be parsed by calling with radix = 2.

    static int parseInt(String s, int radix) 
    

    Parses the string argument as a signed integer in the radix specified by the second argument.

    —

    EDIT:
    According to the comments Byte.parseByte is the way to go.

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is no need of regex here and you can… May 17, 2026 at 1:39 am
  • Editorial Team
    Editorial Team added an answer Look at the USPhoneNumberField's clean() method. May 17, 2026 at 1:39 am
  • Editorial Team
    Editorial Team added an answer It would probably be best if you simply checked for… May 17, 2026 at 1:39 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

In my project i am getting 2008-02-01T10:03:23.793-06:00 this date format in string i have
I have a project that I'm upgrading from 2008 to 2010. My problem is
I have an Android 1.6 project. Can I directly convert it to 2.0?
I have a fairly large work project that uses pygtk for the GUI and
I'm learning J2EE and migrating my ASP.NET project into Java. IN Asp.NET I have
I've developed an equation parser using a simple stack algorithm that will handle binary
This relates to a project to convert a 2-way ANOVA program in SAS to
I have an existing J2EE project which is very big and old. Therefore, my
For a long time now I have noticed something annoying when working on Web
I'm working on a project about Data structures. In the first , I wrote

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.