Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Write binary string

  1. #1
    Junior Member
    Join Date
    May 2013
    Thanked 0 Times in 0 Posts

    Default Write binary string

    Sorry, i am not good in english.

    I want to ask to all of you. Assume i have string 11001100. I want to write that string with exact bit. So, my file will be 1 byte not 8 byte (because each char will give 8 bit). How i can do that?
    Sorry if u dont understand what i mean >.<

    Thank you before

  2. #2
    Administrator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,645 Times in 2,615 Posts

    Default Re: Write binary string

    The Integer class has a parse method that will convert a String to an int value. For a String with binary digits, use a radix of 2.

    Also look at the Byte class's parse method.

Similar Threads

  1. NullPointerException when comparing string in binary tree
    By tetkun in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 19th, 2013, 18:57
  2. Replies: 7
    Last Post: January 23rd, 2013, 20:04
  3. How to write 2 dimensional array of float numbers to binary file?
    By Ghuynh in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: June 17th, 2010, 16:26
  4. How to Write and Read Binary Data
    By neo_2010 in forum File Input/Output Tutorials
    Replies: 3
    Last Post: January 4th, 2010, 13:38
  5. How to Write and Read Binary Data
    By neo_2010 in forum Java Code Snippets and Tutorials
    Replies: 3
    Last Post: January 4th, 2010, 13:38