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 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

Related Questions

For a Javascript project I have an json string converted into a Javascript object.
Recently, I have to convert an java project related to rsa/des encryption into an
I have a project that I am trying to convert to OSGi. However, this
In my iPhone project,I need to convert NSData object to file.I have to convert
I have a project where I need to convert a XML file to CSV
I have a .NETCF project that I have been trying to convert from .NETCF
I have been given a project and asked to convert it to binary so
I recently have convert my project from VB6 to VB.NET2008, after the convert here
I have tried to convert an SVN project to Mercurial using svnsync and then:
I have a project working fine under MSVS 2010 SP1. I'm trying to convert

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.