java - A static method parseInt(char[]) that converts an array of numeric characters to an int value -


this question has answer here:

here's code

public static int[] parseint(char[] mychar) {           int[] myint = new int[mychar.length];     for(int x = 0; x < mychar.length; x++)     {                 myint[x] = (int)mychar[x];     }     return myint; } 

when system.out.println(object.parseint(mychar)); values {'1','2','3'} expect print myint corresponding unicode values {'1','2','3'}.

instead [i@15db9742

any ideas on i'm doing wrong?

that because printing object, hence java shows:

[i - name of type (in case 1 dimensional [ array of int)  @ - joins string 15db9742the hashcode of object. 

the memory address default. can use:

system.out.println(arrays.aslist(parseint(array))); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -