In Paillier homomorphism, how do you deal with bit length? I'm trying to figure out homomorphic encryption and would like to multiply two paillier encrypted numbers. 
Like so: 
[a].[b]=[a+b]

To try this I got this Paillier.java and tried the following: 

BigInteger Paillier p = new Paillier (2048);
BigIntegera=p.encrypt(BigInteger.valueOf(12345));
BigInteger b=p.encrypt(BigInteger.valueOf(54321));
BigInteger c=a.multiply(b);
BigInteger res=p.decrypt(c)


Except this gives me the error 

Exception in thread "main" java.lang.Exception: Paillier.decrypt(BigInteger c): ciphertext c is not in Z*_{n^2}
    at pet4.Paillier.decrypt(Paillier.java:180)
    at pet4.Main.main(Main.java:13)


Now looking at the bitcount of c I can see that it's above 4000 (it varies a bit). So how do we deal with the fact that multiplying paillier encryped numbers results in larger bitcounts?
What you're missing is the fact that your $c$ value can get waaay beyond what the library is expecting there and thus issues an error which can be read as "your value is too large".

The solution is simple: Reduce the multiplication result $\bmod N^2$, where $N=pq$ is the actual value of your modulus.

The code-line which you would need to add there would then be

 c=c.remained(p.getNsquare())


after the multiplication.