String to String Array Java -


i have big problem. have try search solution, don't have find solution. have code

public static string getstring() throws ioexception {      string content = null;     file folder = new file("c:\\soluzioni.txt");      content = fileutils.readfiletostring(folder) + "\n";     string remainingstring = content.substring(content.indexof("["),             content.lastindexof("]") + 1);     system.out.println(remainingstring);     return remainingstring;  } 

and ok. (for clarity)

output :[40,-13,-6,-7,-4] [28,-40,45,-29,37] [-43,19,-24,-9,-45] [26,-41,-28,-16,44] 

my problem now:

public static string[] arg() throws ioexception {     string[] strarray = { getstring() };     system.out.println(strarray);     return strarray; } 

when print strarray, have error (eclipse show me this: [ljava.lang.string;@796686c8). need string (remainingstring) become array of strings(strarray), maintained same format, is, output :[40,-13,-6,-7,-4] [28,-40,45,-29,37] [-43,19,-24,-9,-45] [26,-41,-28,-16,44] array format. thank much!

arrays objects in java, don't override object's tostring() method, responsible output: [ljava.lang.string;@796686c8

in other words, method returns string equal value of:

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

use arrays.tostring generate expected array output:

system.out.println(arrays.tostring(strarray)); 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -