java - Using a tab of ints returned from method in main -


i have problem code-this metod returns tab of ints:

int[] czynnikipierwsze(int n){     dzielniki=new int[20];     for(int j=0;j<n;j++){     for(int i=0;i<n;i++){         if(n%tab[i]==0){             dzielniki[j]=tab[i];             n=n/tab[i];             break;         }     }     }     return dzielniki; } 

there example {2,2,3,8,0,0,0,0,0} in tab(dzielniki). how can use tab in main , print numbers ? created new object , used method:

rozkladliczby a=new rozkladliczby(100);     system.out.println(a.czynnikipierwsze(69)); 

and werid output: [i@1693b52b - because want print whole tab @ once, how can print property ?

an array of ints object too, "class" doesn't override tostring method object, responsible "weird output" see:

in other words, method returns string equal value of:

getclass().getname() + '@' + integer.tohexstring(hashcode()) 

print array using arrays.tostring instead.

system.out.println(arrays.tostring(a.czynnikipierwsze(69))); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -