title: How do i concatenate two BigInteger variables together?
body: <p>I have two BigInteger variables "e" and "n" and i want to concatenate them together as "en".. how do i do this?</p>
  
  <p>Do i need to convert to a string first then back to BigInteger?</p>
  
  <p>My code sets the variables from another class. </p>
  
  <pre><code>public class Key {
  
  public BigInteger getN() {
      return n;
  }
  
  public void setN(BigInteger n) {
      this.n = n;
  }
  
  
  
  public BigInteger getE() {
      return e;
  }
  
  public void setE(BigInteger e) {
      this.e = e;
  }
  
  public BigInteger getD() {
      return d;
  }
  
  public void setD(BigInteger d) {
      this.d = d;
  }
  
  
  
  
  public BigInteger e;
  
  public BigInteger n;
  public BigInteger d;
  
  
  
  public BigInteger publickeyconcat() {
  
  
      BigInteger myval = (e + n);
  
      return myval;
  }
  
      public BigInteger privatekeyconcat(){
  
          BigInteger myval2 = e;
  
          return myval2;
  
      }
  </code></pre>
  
  <p>}</p>
  
  <p>UPDATE
  Have tried the method given in the comments but when converting to use e and n rather than number1 and number2 it doesn't concat them together.</p>
  
  <pre><code>public BigInteger publickeyconcat() {
  
      BigInteger ten=new BigInteger("10");
  
      BigInteger myval=(e.multiply(ten.pow((int)(Math.floor(Math.log10(e.doubleValue()) + 1)))).add(n));
  
  
      return myval;
  }
  </code></pre>