Https://ide.codingblocks.com/s/122017

i am getting array bound outof index. i know why it is coming but unable to resolve it. plz suggest me some way

The way that you used the function add will keep on decreasing i and j both until both of them are less than 0. This means if size of two arrays are different and if index of one goes less than 0 (let’s say i=0) but other is still greater than 0 (let’s say j=2), in such case your while loop will run again making i=-1 and j=1 and yet again making i =-2 and j=0 and again making i=-3 and j=-1 … And this is where the while loop will actually stop .Hence the earlier two iterations of while loop where i=-1 and i=-2 will cause index out of bound error as index -1 and -2 are not defined for a array in java
All this happens because of OR( || ) used in while loop . Try using AND( && ) till one of i or j hits 0 and then deal with the index which is not zero.

I tried and operator. But unable to store the remaining sum of elements of array. Plz help me

There will be two case after either one of two index hits 0.Either i is greater than zero or j is greater than zero .
In a case where i is greater than zero and j is not you’ll have to copy the remaining elements of array with index i . similarly for the other case if j is greater than 0 and i is not greater than 0 then you’ll have to copy element of array with index j into the final array.Check the two additional while loops in the code .

https://ide.codingblocks.com/s/122396.still 2 test case failing

That is because you have not taken care of the carry left at last.Example if the number are 8000 and 3000 then the result will be 11000 but in our code it will be 1000.A quick solution will be to display carry in add function if it is not equal to zero.Check add function in the code below.