Returns whether 2 shapes are equals by checking for dimension semantics
as well as array equality

@param shape1 the first shape for comparison
@param shape2 the second shape for comparison
@return whether the shapes are equivalent
323197
public static boolean shapeEquals(int[] shape1, int[] shape2) {
        if (isColumnVectorShape(shape1) && isColumnVectorShape(shape2)) {
            return Arrays.equals(shape1, shape2);
        }

        if (isRowVectorShape(shape1) && isRowVectorShape(shape2)) {
            int[] shape1Comp = squeeze(shape1);
            int[] shape2Comp = squeeze(shape2);
            return Arrays.equals(shape1Comp, shape2Comp);
        }

        //scalars
        if(shape1.length == 0 || shape2.length == 0) {
            if(shape1.length == 0 && shapeIsScalar(shape2)) {
                return true;
            }

            if(shape2.length == 0 && shapeIsScalar(shape1)) {
                return true;
            }
        }


        shape1 = squeeze(shape1);
        shape2 = squeeze(shape2);

        return scalarEquals(shape1, shape2) || Arrays.equals(shape1, shape2);
    }
1276698
public static boolean isMatrix(IntBuffer shapeInfo) {
        int rank = Shape.rank(shapeInfo);
        if (rank != 2)
            return false;
        return !isVector(shapeInfo);
    }
665756
public static boolean isMatrix(DataBuffer shapeInfo) {
        int rank = Shape.rank(shapeInfo);
        if (rank != 2)
            return false;
        return !isVector(shapeInfo);
    }
522477
private boolean equalShapes(Shape a, Shape b) {
		a.checkPoints();
		b.checkPoints();
		
		for (int i=0;i<a.points.length;i++) {
			if (a.points[i] != b.points[i]) {
				return false;
			}
		}
		
		return true;
	}
815092
public static boolean isRowVectorShape(IntBuffer shapeInfo) {
        int rank = Shape.rank(shapeInfo);
        IntBuffer shape = Shape.shapeOf(shapeInfo);
        return (rank == 2 && shape.get(0) == 1) || rank == 1;

    }
1289156
public static boolean areObjectsEqual(Object obj1, Object obj2) {
        boolean equal = false;
        if(obj1 == null && obj2 == null) {
            equal = true;
        } else {
            if(obj1 != null) {
                if(obj1.equals(obj2)) {
                    equal = true;
                }
            }
        }
        return equal;
    }
261135
public static boolean equalsValue(final BigDecimal bd1, final BigDecimal bd2) {
        if (bd1 == null) {
            return bd2 == null;
        }
        return BigDecimalUtil.isSameValue(bd1, bd2);
    }
1089530
public static boolean isValueEquals(BigDecimal decimal1, BigDecimal decimal2) {
		if (decimal1 == null && decimal2 == null) return true;
		if (decimal1 == null && decimal2 != null) return false;
		if (decimal1 != null && decimal2 == null) return false;
		return cutInvalidSacle(decimal1).equals(cutInvalidSacle(decimal2));
	}
902374
public static boolean equalsOrBothNull(final Object object1, final Object object2) {
        return object1 == null && object2 == null || object1 != null && object1.equals(object2);
    }
671618
public static boolean isEqualOrNull( Object s1,
                                         Object s2 ) {
        if ( s1 == null
                && s2 == null ) {
            return true;
        } else if ( s1 != null
                && s2 != null
                && s1.equals( s2 ) ) {
            return true;
        }
        return false;
    }
874983
@Override
    public double similarity(Vertex<V> vertex1, Vertex<V> vertex2) {
        return similarity(vertex1.vertexID(), vertex2.vertexID());
    }
372811
public boolean contains(Shape other) {
    	if (other.intersects(this)) {
    		return false;
    	}
    	
    	for (int i=0;i<other.getPointCount();i++) {
    		float[] pt = other.getPoint(i);
    		if (!contains(pt[0], pt[1])) {
    			return false;
    		}
    	}
    	
    	return true;
    }
898673
public static boolean objectsNotEqual(final Object one, final Object two) {

        return (one == null) ? (two != null) : (!one.equals(two));

    }
1300337
public static boolean intInsnEqual(IntInsnNode node1, IntInsnNode node2)
	{
		if (node1.operand == -1 || node2.operand == -1)
			return true;

		return node1.operand == node2.operand;
	}
983003
public static final int compare(MemorySegment seg1, MemorySegment seg2, int offset1, int offset2, int len) {
		final byte[] b1 = seg1.memory;
		final byte[] b2 = seg2.memory;
		
		int val = 0;
		for (int pos = 0; pos < len && (val = (b1[offset1 + pos] & 0xff) - (b2[offset2 + pos] & 0xff)) == 0; pos++);
		return val;
	}
43484
public static <T> boolean compareLists(List<T> list1, List<T> list2) {
        if (list1 == list2)
            return true;
        if (list1 == null || list2 == null)
            return false;
        if (list1.size() != list2.size())
            return false;

        for (int i = 0; i < list1.size(); i++) {
            if (!list1.get(i).equals(list2.get(i))) {
                return false;
            }
        }
        return true;
    }
564012
public static final boolean intersection(Rectangle src1, Rectangle src2, Rectangle dest)
    {
        int x1 = Math.max(src1.x, src2.x);
        int y1 = Math.max(src1.y, src2.y);
        int x2 = Math.min(src1.x + src1.width, src2.x + src2.width);
        int y2 = Math.min(src1.y + src1.height, src2.y + src2.height);
        dest.setBounds(x1, y1, x2 - x1, y2 - y1);

        if (dest.width <= 0 || dest.height <= 0)
            return false;

        return true; // non-empty intersection
    }