title: Multiply string - [Leetcode] Problem with Java
body: <p><strong>Question is:</strong></p>
  <p><em>Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.</em></p>
  <p><em>Note: You must not use any built-in BigInteger library or convert the inputs to integer directly.</em></p>
  <p><strong>Code:</strong></p>
  <pre><code>class Solution {
      public String multiply(String num1, String num2) {
          long n1=0, n2=0, res;
          n1 =  Long.parseLong(num1);
          n2 =  Long.parseLong(num2);
          res = n1 * n2;
          String str = Long.toString(res);
          return str;
      }
  }
  </code></pre>
  <p><strong>My Doubt:</strong></p>
  <p>Its working properly when I give smaller number is like:</p>
  <blockquote>
  <p>Input :40,
  90</p>
  </blockquote>
  <blockquote>
  <p>Output:3600</p>
  </blockquote>
  <blockquote>
  <p>Input :100,
  2099</p>
  </blockquote>
  <blockquote>
  <p>Output:209900</p>
  </blockquote>
  <p>If i give input like this:</p>
  <blockquote>
  <p>Input :498828660196, 840477629533</p>
  </blockquote>
  <blockquote>
  <p>Output:&quot;-3269442614257959980&quot;</p>
  </blockquote>
  <p>But the Actual output is : 419254329864656431168468. I don't know why answer coming like this. am also using long datatype. Anyone explain me and give solution for this problem.</p>