java - Outputting List<int[]> does not work -


this question has answer here:

i'm trying figure out why code isn't outputting coin change permutations list list of int arrays. it's outputting hex value (or whatever i@64578ceb is).

any thoughts?

call:

system.out.println("permutations list: " + dan.makechange(27)); 

code:

public class person { int[] denominations, coinvalues; list<int[]> resultslist;  public person() {     denominations = new int[]{25, 10, 5, 1};     resultslist = new arraylist<int[]>(); }   public list<int[]> makechange(int change) {    return resultslist= changemaker(change, new int[] {0,0,0,0}); }  public list<int[]> changemaker(int change, int[] toadd) {                    if (change == 0) {         resultslist.add(toadd);         return resultslist;     }      (int = 0; < denominations.length; i++) {         if (change >= denominations[i]) {             int[] temp = toadd;             temp[i]++;             resultslist = changemaker(change-denominations[i], temp);         }     }     return resultslist; } 

output:

permutations list: [[i@64578ceb, [i@64578ceb, [i@64578ceb, [i@64578ceb, [i@64578ceb, [i@64578ceb, etc... 

int[] doesn't have pretty tostring() display numbers, need write own method accept int[] , print in whatever format want


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -