question: private static boolean isSameClassPackage ( ClassLoader loader1 , String name1 , ClassLoader loader2 , String name2 ) { if ( loader1 != loader2 ) { return false ; } else { int lastDot1 = name1 . lastIndexOf ( '.' ) ; int lastDot2 = name2 . lastIndexOf ( '.' ) ; if ( ( lastDot1 == - 1 ) || ( lastDot2 == - 1 ) ) { return ( lastDot1 == lastDot2 ) ; } else { int idx1 = 0 ; int idx2 = 0 ; if ( name1 . charAt ( idx1 ) == '[' ) { do { idx1 ++ ; } while ( name1 . charAt ( idx1 ) == '[' ) ; if ( name1 . charAt ( idx1 ) != 'L' ) { throw new InternalError ( "Illegal class name " + name1 ) ; } } if ( name2 . charAt ( idx2 ) == '[' ) { do { idx2 ++ ; } while ( name2 . charAt ( idx2 ) == '[' ) ; if ( name2 . charAt ( idx2 ) != 'L' ) { throw new InternalError ( "Illegal class name " + name2 ) ; } } int length1 = lastDot1 - idx1 ; int length2 = lastDot2 - idx2 ; if ( length1 != length2 ) { return false ; } return name1 . regionMatches ( false , idx1 , name2 , idx2 , length1 ) ; } } }
target:  Returns true if two classes are in the same package; classloader and classname information is enough to determine a class's package 