Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Field;

public class Main {
    public static int hashCode(Object paramObject) {
        int i = 1;
        Field[] arrayOfField = paramObject.getClass().getDeclaredFields();
        int j = arrayOfField.length;
        for (int k = 0;; k++) {
            int m;
            int i1;
            if (k < j) {
                Field localField = arrayOfField[k];
                localField.setAccessible(true);
                try {
                    Object localObject = localField.get(paramObject);
                    m = i * 31;
                    if (localObject == null) {
                        i1 = 0;
                    } else {
                        int n = localObject.hashCode();
                        i1 = n;
                    }
                } catch (IllegalArgumentException localIllegalArgumentException) {
                    localIllegalArgumentException.printStackTrace();
                    continue;
                } catch (IllegalAccessException localIllegalAccessException) {
                    localIllegalAccessException.printStackTrace();
                    continue;
                }
            } else {
                return i;
            }
            i = m + i1;
        }
    }
}