Help with Array output Needed!
This problem has been driving me nuts for a couple of days now, thought I'd post it up and see if you whizzes can tell me what I'm doing wrong?
My problem is that I am passing an array to my method and when I output the array the first time it outputs as normal but then if I pass that array to another method and then output its value again the original value of the array has changed and it's not supposed to..? Anyway's here the gist of the code:
public void trachPrimeFactor (byte  numToFactor)
while ((record = br.readLine()) != null)
lineToByte = convertStringToByte(record);
outputArray(numToFactor); <-- works fine here
outputArray(numToFactor); <-- output is wrong here
Output looks something like this:
0 <--this output is correct, basically I'm just asking 83720%2 at the moment
00000 <-- but I want this to say 83720 as it did before
I thought at first that perhaps the method trachModulus might be changing the array within the method so I just tried:
public byte  trachModulus (byte origNumSent, byte divideByThis)
byte  origNum = origNumSent;
and just used origNum within trachModulus but the result is the same, the original array passed to trachModulus changes.
Can any of you guys see what I'm doing wrong??
Really appreciate any help you can give guys!