class GFG { 
  
    // Driver's code 
    public static void main(String[] args) 
    { 
  
        // Creating 2 Integer arrays 
        int[] arr1 = { 1, 2, 3, 4, 5 }; 
        int[] arr2 = { 6, 2, 7, 0, 8 }; 
  
        // Using Ints.concat() method to combine 
        // elements from both arrays into a single array 
        int[] res = Ints.concat(arr1, arr2); 
  
        // Displaying the single combined array 
        System.out.println("Combined Array: "
                           + Arrays.toString(res)); 
    } 
} 

        

class ArrayUtils
{
	// Java program to demonstrate Guava's Ints.concat() method
	public static void main(String[] args)
	{
		int[] first = { 1, 2, 3 };
		int[] second = { 4, 5 };
		int[] third = { 6, 7, 8 };

		int[] ints = Ints.concat(first, second, third);
		System.out.println(Arrays.toString(ints));
	}
}

        

public void join_two_primitive_arrays_in_java_with_guava () {

    int[] allStateCapitalsByIndex = Ints.concat(firstHalfStateCapitalByIndex, secondHalfStateCapitalByIndex);

    Arrays.toString(allStateCapitalsByIndex);
    assertEquals(50, allStateCapitalsByIndex.length);
}

        

public void collectionArrayFeatures() {
/**
  * Thanks to Google Guava we can also simply concatenate two or more arrays. Once again, this example shows the feature for arrays but it can be applied to all wrappers
         * (Ints, Doubles, Longs, Shorts, Booleans, Bytes, Floats and Chars).
         */
        int[] century18 = new int[]{1750, 1790};
        int[] century19 = new int[]{1850, 1890};
        int[] century20 = new int[]{1950, 1990};
        int[] allYears = Ints.concat(century18, century19, century20);
        assertTrue("allYears[0] should be 1750 but is "+allYears[0], allYears[0] == 1750);
        assertTrue("allYears[1] should be 1750 but is "+allYears[1], allYears[1] == 1790);
        assertTrue("allYears[2] should be 1750 but is "+allYears[2], allYears[2] == 1850);
        assertTrue("allYears[3] should be 1750 but is "+allYears[3], allYears[3] == 1890);
        assertTrue("allYears[4] should be 1750 but is "+allYears[4], allYears[4] == 1950);
        assertTrue("allYears[5] should be 1750 but is "+allYears[5], allYears[5] == 1990);
}

        

public static void main(String[] args) { 
	int[] concatResult = Ints.concat(new int[]{1, 2, 3, 4, 5, 6, 7},
	new int[]{8, 9, 10}, new int[]{11, 12, 13, 14});
	System.out.println(Ints.join("|", concatResult));

	// 1|2|3|4|5|6|7|8|9|10|11|12|13|14
}

        

public static List<BakedQuad> createBakedQuadCuboid(float x1, float y1, float z1, float x2, float y2, float z2, TextureAtlasSprite sprite, int red, int green, int blue, int alpha) {
	List<BakedQuad> quads = new ArrayList<BakedQuad>();
	
	int color = (alpha & 0x0ff) << 24 | (blue & 0x0ff) << 16 | (green & 0x0ff) << 8 | (red & 0x0ff);
	int[] vertexData;
	
	vertexData = Ints.concat(
			vertexToInts(x2, y2, z1, color, sprite, x2 * 16, y1 * 16),
			vertexToInts(x2, y1, z1, color, sprite, x2 * 16, y2 * 16),
			vertexToInts(x1, y1, z1, color, sprite, x1 * 16, y2 * 16),
			vertexToInts(x1, y2, z1, color, sprite, x1 * 16, y1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.NORTH, sprite, false, DefaultVertexFormats.BLOCK));
	vertexData = Ints.concat(
			vertexToInts(x1, y2, z2, color, sprite, x1 * 16, y1 * 16),
			vertexToInts(x1, y1, z2, color, sprite, x1 * 16, y2 * 16),
			vertexToInts(x2, y1, z2, color, sprite, x2 * 16, y2 * 16),
			vertexToInts(x2, y2, z2, color, sprite, x2 * 16, y1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.SOUTH, sprite, false, DefaultVertexFormats.BLOCK));
	vertexData = Ints.concat(
			vertexToInts(x1, y2, z1, color, sprite, z1 * 16, y1 * 16),
			vertexToInts(x1, y1, z1, color, sprite, z1 * 16, y2 * 16),
			vertexToInts(x1, y1, z2, color, sprite, z2 * 16, y2 * 16),
			vertexToInts(x1, y2, z2, color, sprite, z2 * 16, y1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.WEST, sprite, false, DefaultVertexFormats.BLOCK));
	vertexData = Ints.concat(
			vertexToInts(x2, y2, z2, color, sprite, z2 * 16, y1 * 16),
			vertexToInts(x2, y1, z2, color, sprite, z2 * 16, y2 * 16),
			vertexToInts(x2, y1, z1, color, sprite, z1 * 16, y2 * 16),
			vertexToInts(x2, y2, z1, color, sprite, z1 * 16, y1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.EAST, sprite, false, DefaultVertexFormats.BLOCK));
	vertexData = Ints.concat(
			vertexToInts(x2, y1, z1, color, sprite, x2 * 16, z1 * 16),
			vertexToInts(x2, y1, z2, color, sprite, x2 * 16, z2 * 16),
			vertexToInts(x1, y1, z2, color, sprite, x1 * 16, z2 * 16),
			vertexToInts(x1, y1, z1, color, sprite, x1 * 16, z1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.DOWN, sprite, false, DefaultVertexFormats.BLOCK));
	vertexData = Ints.concat(
			vertexToInts(x1, y2, z1, color, sprite, x1 * 16, z1 * 16),
			vertexToInts(x1, y2, z2, color, sprite, x1 * 16, z2 * 16),
			vertexToInts(x2, y2, z2, color, sprite, x2 * 16, z2 * 16),
			vertexToInts(x2, y2, z1, color, sprite, x2 * 16, z1 * 16));
	quads.add(new BakedQuad(vertexData, 0, EnumFacing.UP, sprite, false, DefaultVertexFormats.BLOCK));
	
	return quads;
}

        

public static int[] getDimensions(Object array) {
    int[] dimensions = new int[0];
    Class<?> type = array.getClass();
    while (type.isArray()) {
        int length = array != null ? Array.getLength(array) : 0;
        dimensions = Ints.concat(dimensions, new int[] { length });
        array = length > 0 ? Array.get(array, 0) : null;
        type = type.getComponentType();
    }
    return dimensions;
}

        

public void testConcat() {
 assertTrue(Arrays.equals(EMPTY, Ints.concat()));
 assertTrue(Arrays.equals(EMPTY, Ints.concat(EMPTY)));
 assertTrue(Arrays.equals(EMPTY, Ints.concat(EMPTY, EMPTY, EMPTY)));
 assertTrue(Arrays.equals(ARRAY1, Ints.concat(ARRAY1)));
 assertNotSame(ARRAY1, Ints.concat(ARRAY1));
 assertTrue(Arrays.equals(ARRAY1, Ints.concat(EMPTY, ARRAY1, EMPTY)));
 assertTrue(
   Arrays.equals(new int[] {(int) 1, (int) 1, (int) 1}, Ints.concat(ARRAY1, ARRAY1, ARRAY1)));
 assertTrue(
   Arrays.equals(
     new int[] {(int) 1, (int) 2, (int) 3, (int) 4}, Ints.concat(ARRAY1, ARRAY234)));
}

        

public static IComplexNDArray repeat(IComplexNDArray n, int num) {
  List<IComplexNDArray> list = new ArrayList<>();
  for (int i = 0; i < num; i++)
    list.add(n.dup());
  IComplexNDArray ret = Nd4j.createComplex(list, Ints.concat(new int[] {num}, n.shape()));
  logCreationIfNecessary(ret);
  return ret;
}

        

public static double[] toDoubles(int[][] ints) {
  return toDoubles(Ints.concat(ints));
}        
main