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.


>> REGISTER NOW TO START POSTING


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
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Write binary string

    Hello
    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
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,592
    Thanks
    50
    Thanked 2,235 Times in 2,207 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.
    If you don't understand my answer, don't ignore it, ask a question.

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, 06:57 PM
  2. Replies: 7
    Last Post: January 23rd, 2013, 08:04 PM
  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, 04:26 PM
  4. How to Write and Read Binary Data
    By neo_2010 in forum File Input/Output Tutorials
    Replies: 3
    Last Post: January 4th, 2010, 01:38 PM
  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, 01:38 PM