import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int MassCurrentsPhases[] = new int[]{280, 285, 390, 410, 420, 540, 550, 620, 630, 650, 700, 720, 780, 852, 860, 900, 1300, 1310, 1320, 1340, 1350, 1370, 1380, 1400, 1410, 1540, 1645, 1760, 1880, 1990, 2010, 2120, 2240, 2360, 2470, 2590, 2600, 2620, 2640, 2660, 2690, 2710, 2730, 2850, 2970, 3190, 3310, 3339, 3350, 3380};
byte[] streamedResponse = new byte[100];
for (int iWord = 0, iByte = 4; iWord < 50; ++iWord, iByte += 2) {
int w = MassCurrentsPhases[iWord];
streamedResponse[iByte] = (byte)w;
streamedResponse[iByte + 1] = (byte)(w >> 8);
}
System.out.println(Arrays.toString(streamedResponse));
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 100
at Main.main(Main.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Process finished with exit code 1
int inMass[] = new int[]{280, 285, 390, 410, 420, 540, 550, 620, 630, 650, 700, 720, 780, 852, 860, 900, 1300, 1310, 1320, 1340, 1350, 1370, 1380, 1400, 1410, 1540, 1645, 1760, 1880, 1990, 2010, 2120, 2240, 2360, 2470, 2590, 2600, 2620, 2640, 2660, 2690, 2710, 2730, 2850, 2970, 3190, 3310, 3339, 3350, 3380};
int asInts = Float.floatToIntBits(asFloat);
byte[] data = new byte[4];
data[0] = (byte)asInts;
data[1] = (byte)(asInts >> 8);
data[2] = (byte)(asInts >> 16);
data[3] = (byte)(asInts >> 24);
System.out.println("Значение обратно" + Arrays.toString(data));