Results 1 to 2 of 2
- 10-07-2012, 08:27 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 1
- Rep Power
- 0
How to resolve: Returning 3d array problem
Hello! My problem is that i created a class where i did a method and this method returning with a 3d array. When i wud like to use this array in an other class suddenly its a empty array with full of zero.
If someone could help me out i'd appriciate it thx.
Here's the code:
Java Code:public class BetarEgy extends Raktar{ BetarEgy(){ super.Randomallapot(); } public int[][][] betar1(int textfield){ int tomb[][][]=new int[4][25][2]; boolean betarolt=false; for(int k=0;k<textfield;k++){ for (int i=0;i<4;i++){ for(int j=0;j<25;j++){ if(raktar[i][j][0]==0 && raktar[i][j][1]==0 && raktar[i][j][2]==0){ raktar[i][j][0]=1 + gen.nextInt(25)+(i*4); raktar[i][j][1]=gen.nextInt(2); raktar[i][j][2]=gen.nextInt(8)+1; tomb[i][j][0]=i; tomb[i][j][1]=j; System.out.println(" Sor: "+tomb[i][j][0]+" Oszlop: "+tomb[i][j][1]); } } } } return tomb; } }
Above i checked with a print method thatthe array does contain the numbers what i need and it does
Thx for take a look at it :)Java Code:public class Fifo extends BetarEgy{ private final BetarKetto os= new BetarKetto(); // private final BetarEgy t= new BetarEgy(); boolean kitarolt=false; final int kitartomb[][][]=betar1(textfield); //This is the array what i actually wud like to use double ido[]= new double[100]; double szamol; public double[] FifoKitar1(int textfield){ for(int k=0; k<textfield;k++){ for(int i=0;i<3;i++){ for (int j=0;j<24;j++){ if(i==kitartomb[i][j][0] && j==kitartomb[i][j][1]){ System.out.println(" SorFifo: "+kitartomb[i][j][0]+" OszlopFifo: "+kitartomb[i][j][1]); tav=((Integer)raktar[i][j][0]).intValue(); szamol=tav/(double)seb; ido[k] = szamol; //System.out.print(" Idő: "+ido[k]+"\nTavolsag: "+tav+" Raktaradattav: "+raktar[i][j][0]); raktar[i][j][0]=0; raktar[i][j][1]=0; raktar[i][j][2]=0; kitarolt=true; break; } } if(kitarolt==true){ break; } } } return ido; }Last edited by djpista; 10-07-2012 at 08:47 PM.
- 10-07-2012, 08:39 PM #2
Re: How to resolve: Returning 3d array problem
Please edit you post and wrap the code in code tags. See: BB Code List - Java Programming Forum
If you don't understand my response, don't ignore it, ask a question.
Similar Threads
-
Returning Array Row
By Zocheyado in forum New To JavaReplies: 2Last Post: 04-15-2011, 02:23 AM -
returning an array weird problem
By mcleanj in forum New To JavaReplies: 4Last Post: 01-28-2011, 05:29 AM -
Problem returning Array values Please help
By drgnfire25 in forum New To JavaReplies: 4Last Post: 01-12-2011, 12:53 AM -
Someone come resolve this problem of mine, please!!!
By gabriel landry in forum Advanced JavaReplies: 19Last Post: 11-12-2010, 11:32 AM -
Returning array problem.
By Chase in forum New To JavaReplies: 4Last Post: 10-21-2008, 09:07 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks