PyMultiarray __not__(final PyMultiarray a) {
        if (!a.isContiguous) { throw Py
                .ValueError("internal __not__ requires contiguous matrix as argument"); }
        // final int maxI = a.start + PyMultiarray.shapeToNItems(a.dimensions);
        switch (a._typecode) {
        case '1':
            final byte aData1[] = (byte[]) a.data;
            for (int i = 0; i < Array.getLength(a.data); i++) {
                aData1[i] = (byte) (~aData1[i]);
            }
            break;
        case 's':
            final short aDatas[] = (short[]) a.data;
            for (int i = 0; i < Array.getLength(a.data); i++) {
                aDatas[i] = (short) (~aDatas[i]);
            }
            break;
        case 'i':
            final int aDatai[] = (int[]) a.data;
            for (int i = 0; i < Array.getLength(a.data); i++) {
                aDatai[i] = (~aDatai[i]);
            }
            break;
        case 'l':
            final long aDatal[] = (long[]) a.data;
            for (int i = 0; i < Array.getLength(a.data); i++) {
                aDatal[i] = (~aDatal[i]);
            }
            break;
        case 'f':
            throw Py.ValueError("not not supported for type Float");
        case 'd':
            throw Py.ValueError("not not supported for type Double");
        case 'O':
            final PyObject aDataO[] = (PyObject[]) a.data;
            for (int i = 0; i < Array.getLength(a.data); i++) {
                aDataO[i] = (aDataO[i].__not__());
            }
            break;
        case 'F':
            throw Py.ValueError("not not supported for type ComplexFloat");
        case 'D':
            throw Py.ValueError("not not supported for type ComplexDouble");
        default:
            throw Py.ValueError("typecode must be in [1silfFdDO]");
        }
        return a;
    }