iNET Interactive - Online Advertising Agency
          
General Topics include: .NET Framework
Note: Most posts can be categorized into one of the forums below, where experts on that topic will be able to help you find a solution to your problem faster and more efficiently.

Go Back  Xtreme .NET Talk > .NET > General > How to convert Binary number to Hex number?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2004, 06:23 AM
Angelus Angelus is offline
Newcomer
 
Join Date: Nov 2003
Posts: 16
Angelus is on a distinguished road
Default How to convert Binary number to Hex number?

How can I convert directly from binary number to hex number without first convert binary to decimal and then from decimal to hex number?
Reply With Quote
  #2  
Old 07-19-2004, 07:34 AM
bri189a's Avatar
bri189a bri189a is offline
Senior Contributor

Preferred language:
C#, VB.NET
 
Join Date: Sep 2003
Location: VA
Posts: 1,004
bri189a is on a distinguished road
Default

Quote:
Originally Posted by Angelus
How can I convert directly from binary number to hex number without first convert binary to decimal and then from decimal to hex number?
You would have to make your own procedure. The conversion is easy. Make sure your binary is divisible by 4; if not append the beginning of the binary with 0's until it is a multiple of 4, then group your binary digits into groups of 4. Here is the conversion:

0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = A
1011 = B
1100 = C
1101 = D
1110 = E
1111 = F

As long as you can break things down into groups of four this will work for the entire number no matter how large it is.

Hope this helps you in your endeavors.
Reply With Quote
  #3  
Old 07-19-2004, 07:45 AM
Hamburger1984 Hamburger1984 is offline
Centurion

Preferred language:
C#!!!!
 
Join Date: Jun 2003
Location: Hamburg,Germany
Posts: 162
Hamburger1984 is on a distinguished road
Default

see attachment!

Hope this helps!

Andreas
Attached Files
File Type: zip BinaryToHex.zip (7.5 KB, 39 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Letter to Number [C#] Shaitan00 General 1 03-18-2006 10:25 PM
binary number .net OmarB General 2 09-23-2005 11:02 AM
Convert number to ascii char Diesel General 2 08-24-2004 02:46 PM
VB.Net - How to convert decimal number to HEX or Binary? predseda General 4 06-29-2004 12:24 PM
How to Create a Function that accepts different number ofparameters based on a number sureshcd10 ASP.NET 1 05-09-2004 06:51 AM

Advertisement: