Example #1
0
        /// <summary>
        /// Converts the specified int value into binary representation
        /// (actually a string rep of the binary).
        /// </summary>
        /// <param name="valToConvert">The val to convert.</param>
        /// <returns></returns>
        public static string GetStringRep(int valToConvert)
        {
            int[]    binaryRep       = DecimalToBinaryConverter.Convert(valToConvert);
            string[] binaryRepString = new string[15];

            for (int i = binaryRepString.Length - 1; i >= 0; i--)
            {
                binaryRepString[i] = binaryRep[i].ToString();
            }

            return(String.Join("", binaryRepString));
        }
Example #2
0
 /// <summary>
 /// returns the bits for assembly Ainstruction
 /// </summary>
 /// <param name="val"></param>
 /// <returns></returns>
 public static string Get_AInstruction(string val)
 {
     return("0" + DecimalToBinaryConverter.GetStringRep(int.Parse(val)));
 }