Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hex to Binary Converter in java...
- From: uddipan@xxxxxxxxxxxxxxxx (Uddipan Bagchi)
- Subject: Hex to Binary Converter in java...
- Date: Wed, 03 Feb 1999 12:45:30 +0530
Allen,
The attached code will point you in the right direction.
______________________________________________________________
import java.io.*;
public class HexToByteConverter{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = null;
while (!(line = br.readLine()).equals("")){
for (int i = 0,j = line.length(); i < j; i++){
System.out.print(Integer.toBinaryString(Character.digit(line.charAt(i),16)));
}
System.out.println();
}
}
}
____________________________________________________________
Hope it helps.
- Uddipan.
_________________
Allen Tuggle wrote:
> I realize this isn't the hardest question in the world but i'm trying to
> convert a file I have from hex to binary and it has been a while since I
> worked with hex to binary conversions. So if anyone can point me or give me
> any information I would greately appreciate it!
>
> Thanks,
> Allen
>
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- Next by Date: Is-a Versus Has-a
- Next by thread: Is-a Versus Has-a
- Index(es):