public String multiply(String num1, String num2) {

    StringBuffer sb = new StringBuffer();

    num1 = new StringBuffer(num1).reverse().toString();
    num2 = new StringBuffer(num2).reverse().toString();

    // this array stores
    int[] arr = new int[num1.length() + num2.length()];
    for (int i = 0 ; i < num1.length() ; i++) {
      int a = num1.charAt(i) - '0';
      for (int j = 0 ; j < num2.length() ; j++) {
        int b = num2.charAt(j) - '0';
        arr[i + j] += a * b;
      }
    }

    System.out.println(Arrays.toString(arr));

    int carry = 0;
    for (int i : arr) {
      i += carry;
      sb.insert(0, (i % 10));
      carry = i / 10;
    }

    System.out.println(sb.toString());

    while (sb.length() > 1 && sb.charAt(0) == '0') {
      sb.deleteCharAt(0);
    }

    return sb.toString();
  }