public void multiply(string number) { BigNumberFacilitator result = new BigNumberFacilitator("0"); for (int idx = number.Length, offset = 0; --idx != -1; ++offset) { int digit = number[idx] - '0'; string product; switch (digit) { case 0: product = "0"; break; case 1: product = d_number; break; default: product = multiplyNumber(d_number, digit, 0, d_number.Length - 1); break; } if (product != "0") { product = appendZeros(product, offset); } result.add(product); } d_number = result.getNumber(); }
static private string hexToDec(string hex) { BigNumberFacilitator factor = new BigNumberFacilitator("1"); BigNumberFacilitator result = new BigNumberFacilitator("0"); while (hex.Length != 0) { int num = hexToInt(hex[hex.Length - 1]); hex = hex.Remove(hex.Length - 1); BigNumberFacilitator temp = new BigNumberFacilitator(num.ToString()); temp.multiply(factor.getNumber()); result.add(temp.getNumber()); factor.multiply("16"); } return(result.getNumber()); }