directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r162031 - /directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java
Date Wed, 20 Apr 2005 18:01:30 GMT
Author: adc
Date: Wed Apr 20 11:01:29 2005
New Revision: 162031

URL: http://svn.apache.org/viewcvs?rev=162031&view=rev
Log:
Util class

Added:
    directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java

Added: directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java
URL: http://svn.apache.org/viewcvs/directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java?rev=162031&view=auto
==============================================================================
--- directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java
(added)
+++ directory/asn1/branches/ber-decoder/modules/runtime/src/java/org/apache/snickers/runtime/ASN1Util.java
Wed Apr 20 11:01:29 2005
@@ -0,0 +1,63 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.snickers.runtime;
+
+
+public final class ASN1Util
+{
+    static boolean equals( byte[] array1, byte[] array2 )
+    {
+        if ( array1 != null )
+        {
+            if ( array2 != null )
+            {
+                if ( array1.length != array2.length ) return false;
+
+                for ( int i = 0; i < array1.length; i++ )
+                {
+                    if ( array1[i] != array2[i] ) return false;
+                }
+            }
+            else
+            {
+                return false;
+            }
+
+        }
+        else
+        {
+            return ( array2 == null );
+        }
+
+        return true;
+    }
+
+    static int hashCode( byte[] array )
+    {
+        int result = 0;
+
+        if ( array != null )
+        {
+            for ( int i = 0; i < array.length; i++ )
+            {
+                result ^= (int) array[i];
+            }
+        }
+
+        return result;
+    }
+}



Mime
View raw message