class ArrayUtils {

    public static int[] toMutualOppositeForm(BigInteger integer) {
        int[] binaryArray = toBinaryArray(integer);
        int binaryLength = binaryArray.length;

        int[] ternaryArray = new int[binaryLength + 1];

        ternaryArray[0] = binaryArray[0];

        for (int i = 1; i < binaryLength; i++) {
            ternaryArray[i] = binaryArray[i] - binaryArray[i - 1];
        }

        ternaryArray[binaryLength] = -binaryArray[binaryLength - 1];

        return ternaryArray;
    }

}