Hi, I read the contents of a file into a byte array and am now trying to convert it into a float array.
here is the code I am using
public static float [] bytetofloat(byte [] convert){
float [] data = new float [convert.length/2];
for(int i = 0;i<convert.length;i+=2){
for(int j = 0; j <data.length;j++){
short valueAsShort = (short)( (convert[i] << 8) | (convert[i+1] & 0xff));
float valueAsFloat = (float)valueAsShort;
System.out.println(valueAsFloat);
valueAsFloat = data[j];
System.out.println(data[j]);
}
}
can anyone see anythign wrong with the way I am doing this? I cant see anythign wrong but need to make sure its fine before I can continue.
any advice on this or a better way to do it would be much appreciated.