Java concatenates two arrays, and java concatenates two arrays.
1 int a [] = {,}; 2 int B [] = {, 98}; 3 int [] d3 = new int [. length + B. length]; 4 System. arraycopy (a, 0, d3, 0,. length); 5 System. arraycopy (B, 0, d3,. length, B. length );
The parameter meaning of System. arraycopy: (src, srcPos, dest, destPos, length) -- (source array, source array start position, target array, target array start position, and copy length)
How to splice two java arrays into json strings:
... You can find a JSON conversion plug-in.
It is easy to merge arrays, and then use the JSON Conversion Tool class. frequently-used ins gson, fastjson, etc.
How to merge two int-type arrays in java?
Public class ContactIntegerArray {
Public static int [] contact (int a [], int B []) {
Int [] f = new int [a. length + B. length];
For (int I = 0; I <f. length; I ++)
If (I <a. length)
F [I] = a [I];
Else
F [I] = B [i-a.length];
Return f;
}
Public static void main (String [] args ){
Int a [] = {1, 3, 4, 7 };
Int B [] = {2, 3, 5 };
Int c [] = ContactIntegerArray. contact (a, B );
}
}