Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

convert text/ascii file to binary file  RSS feed

 
sreedhara satuluri
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,

i have a file in the format of text as well as ascii , i would like to convert this file as binary and store it to another file (i m creating this file) file using java program can any one suggest this one how to do this
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you give an example of what you mean by binary?
For example: text = 'A', binary = "01000001"
these are Strings or characters.
but really the binary for 'A' is x41 or as an int - decimal 65 etc

There are methods to create String representations. See the Integer class.

Everything on a computer is in binary. The meaning a particular grouping of bytes depends on the context. The same bytes could represent a character or a machine instruction or part of an image. Depends how you use them.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!