Example #1
0
 def __calcbinary(self, decimal):
     """
     converts the given integer "decimal" into a string, inheriting
     binary type data
     ###
     decimal - (int) the decimal value
     ###
     RETURNS (string)
     """
     new_binary = ""
     leftover = 0
     temp_value = decimal
     while temp_value != 0:
         # updating the temporary data
         leftover = temp_value % 2
         temp_value = JTString.round_down(temp_value / 2)
         # creating the binary digits
         new_binary = str(leftover) + new_binary
     # returning the new binary value
     return new_binary
Example #2
0
 def __calchexa(self, decimal):
     """
     converts the given integer "decimal" into a string, inheriting
     hecadecimal type data
     ###
     decimal - (int) the decimal value
     ###
     RETURNS (string)
     """
     new_hexa = ""
     leftover = 0
     temp_value = decimal
     while temp_value != 0:
         # updating the temporary data
         leftover = temp_value % 16
         temp_value = JTString.round_down(temp_value / 16)
         # creating the hexadecimal digits
         new_hexa = Hexadecimal.d_to_h[leftover] + new_hexa
     # returning the new hexadecimal value
     return new_hexa