Hi,
I'm a little baffled by this problem okay my float array contains the right float numbers but when I passed them into
my ArrayList that contains a float array the array seems to have new numbers inserted into it
this prints
1.0
-1.0
1.0
-1.0
0
Verts: [1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0]
Verts: 1.0
Verts: 0.0
Verts: -1.0
Verts: 0.0
Verts: 1.0
Verts: 0.0
I'm a little baffled by this problem okay my float array contains the right float numbers but when I passed them into
my ArrayList that contains a float array the array seems to have new numbers inserted into it
public void test1()
{
ArrayList<String >sNumbers = new ArrayList< String >();
sNumbers.add( "1.0" );
sNumbers.add( "1.0" );
sNumbers.add( "-1.0" );
sNumbers.add( "-1.0");
sNumbers.add( "1.0");
sNumbers.add( "0.999999");
sNumbers.add( "-1.0" );
sNumbers.add( "-1.0" );
float[]test = new float[ sNumbers.size() ];
ArrayList< float[] > list = new ArrayList< float[] >();
for( int u = 0; u < test.length; u+=2 )
{
test[ u ] = Float.parseFloat( sNumbers.get( u ) );
System.out.println( test[ u ] );
}
list.add( test );
for( int i = 0; i < list.size(); i++ )
{
System.out.println( i );
System.out.println( "Verts: " + Arrays.toString( list.get( i ) ) );
}
for( int y = 0; y < test.length; y++ )
{
System.out.println( "Verts: " + list.get( 0 )[ y ] );
}
}
this prints
1.0
-1.0
1.0
-1.0
0
Verts: [1.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0]
Verts: 1.0
Verts: 0.0
Verts: -1.0
Verts: 0.0
Verts: 1.0
Verts: 0.0