Welcome to the Ranch
By transfer function, do you mean you transfer a particular amount from one account to another? "Transfer Function" sounds like a complicated mathematical
word for something complicated.
That code looks complicated. There is a lot that could be simplified. You are going to suffer the well-known imprecision of floating-point arithmetic, but have more pressing things to think of at present.
double transferAmount= (new Double(amount)).doubleValue();
That looks complicated, and I would suggest the Double.parseDouble() method.
What you want is to pass two Account objects and an amount to transfer. You withdraw it from one account and deposit it in the other. I would suggest you can get that down to five lines
You don't want to return a new balance from a transfer method; the method does not record the amount, but the Accounts do. You can alternatively use an instance method in one Account and pass the other Account, like this
It looks to me as if you had not been taught any object-orientation. If you create Account classes, and give it withdraw, deposit and getBalance methods, you will find life much easier. You can stop messing around with arrays of arrays, and simply have an Account[] array.