Advertisement
Anubis_Black

Decimal to Hexadecimal

Jan 22nd, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  1.         string[] hexRemainders = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" };
  2.  
  3.             string hexadecimal = string.Empty;
  4.  
  5.             do
  6.             {
  7.                 hexadecimal = hexRemainders[number & 15] + hexadecimal;
  8.                 number >>= 4;
  9.             } while (number != 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement