Adding an array of doubles to an array list gives me weird (hex?) values - java -


i'm getting problems when try add array of doubles arraylist.

arraylist<double[]> vok = new arraylist<double[]>(); 

and method i'm having issues is:

   public void onsensorchanged(sensorevent e) {     if(e.sensor.gettype()==sensor.type_magnetic_field){         double[] temp = new double[3] ;          double x = e.values[0];         temp[0]=x;         double y = e.values[1];         temp[1]=y;         double z = e.values[2];         temp[2]=z;         vok.add(temp);         system.out.println(vok);      } 

when hover on temp in debug, displays correct values e.g.

temp = [40.55999755859375, -20.100000381469727, -28.260000228881836]

i in array when added "vok" end symbols [d@419aeb28] in array (hex?). have tried changing method in add elements vok = arrays.aslist(temp) , changing corresponding types i'm still having same problem. i'm not sure if there better method 1 i'm using i've been working on day , closest i've got. end goal have values stored like:

double[][] vee = {{0.4222307801246643,-0.12258315086364746,-0.2996482849121094},             {-0.4222307801246643,-0.06810164451599121,0.1498241424560547},             {-0.1089627742767334,0.027240753173828125,0.23154544830322266},             {0.0,0.16344404220581055,0.04086112976074219}} 

for use in class requires type of input. please help! :)

don't

system.out.println(vok); 

do

int = 0; (double[] arr : vok) {     system.out.println("vok_" + i++ + " = " + arrays.tostring(arr)); } 

your problem (indirectly) calling tostring() of double[], results in strings [d@419aeb28] , not it's contents.

so code correct , want do. have wrong how present data on console.


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 -