class Byt {

    public static byte[] compact( byte[] array ) {

        int nullCount = 0;
        for ( byte ch : array ) {

            if ( ch == '\0' ) {
                nullCount++;
            }
        }
        byte[] newArray = new byte[ array.length - nullCount ];

        int j = 0;
        for ( byte ch : array ) {

            if ( ch == '\0' ) {
                continue;
            }

            newArray[ j ] = ch;
            j++;
        }
        return newArray;
    }

}