I have that:
byte[] AllNumber = {4,3,2,1,0,5,6,7,8,9};
byte[] MultNumber = {4,3,2,1,0,5,6,7,8,9}; // No matter the content
byte[] DivNumber = {4,3,2,1,0,5,6,7,8,9}; // No matter the content
Alter(AllNumber,MultNumber,DivNumber,5.0,3,2); //The Arrays must be Altered!!
for (int i = 0; i<MultNumber.length; i++) {
System.out.println("MultNumber["+i+"]:"+MultNumber[i]);
}
for (int i = 0; i<DivNumber.length; i++) {
System.out.println("DivNumber["+i+"]:"+DivNumber[i]);
}
Now I have this method:
Alter(byte[] src, byte[] Mlt, byte[] Dvs, double dNum, int Lngt, int Ini) {
// INI THE PROBLEM
Mlt = Arrays.copyOf(Mlt, src.length + Lngt); //HERE IS THE ASSIGNATION
for (int i = ini; i<Mlt.length; i++) {
Mlt[i] = Mlt[i]*dNum; //No matter the operation (to simplify the problem)
}
Dvs = Arrays.copyOf(Dvs, src.length - Lngt); //HERE IS THE ASSIGNATION
for (int i = Ini; i<Dvs.length; i++) {
Dvs[i] = Dvs[i]/dNum; //No matter the operation (to simplify the problem)
}
// END THE PROBLEM
}
Another Attempt
//Another Attempt!!!
Alter(byte[] src, byte[] Mlt, byte[] Dvs, double dNum, int Lngt, int Ini) {
// INI THE PROBLEM
byte[] TM = new byte[src.length + Lngt]
for (int i = ini; i<Mlt.length; i++) {
TM[i] = Mlt[i]*dNum; //No matter the operation (to simplify the problem)
}
Mlt = TM; //HERE IS THE ASSIGNATION
TM = null;
byte[] TD = new byte[src.length - Lngt]
for (int i = Ini; i<Dvs.length; i++) {
TD[i] = Dvs[i]/dNum; //No matter the operation (to simplify the problem)
}
Dvs = TD; //HERE IS THE ASSIGNATION
TD = null;
// END THE PROBLEM
}
I want to get two arrangements changed after performing the call of method "Alter". How I can do it this?
I need to change the length of Arrays!
Thank you for your valuable help.
PD. It seems later to make the assignations to the arrays, the "Call by Reference" is converted in "Call by Value". If THE ASSIGNATION is omitted the "Call by Reference" follows being.