In c# I am converting a byte to binary, the actual answer is 00111111 but the result being given is 111111. Now I really
byte
binary
00111111
111111
public static string ByteArrayToString(byte[] ba) { StringBuilder hex = new StringBuilder(ba.Length * 2); foreach (byte b in ba) hex.AppendFormat("{0:x2}", b); return hex.ToString(); }