tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Jodd > Commons > How to create Hash from Shorts

How to create Hash from Shorts 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use HashCode.hash() API. It calculates the hash code from the given shorts.

File Name  :  
com/bethecoder/tutorials/jodd/hash/HashFromShortsTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jodd.hash;

import jodd.util.HashCode;

public class HashFromShortsTest {

  /**
   @param args
   */
  public static void main(String[] args) {

    int seed = HashCode.SEED;
    int hashCode = HashCode.hash(seed, new short [] { 123,  456789 });
    System.out.println(hashCode);
    
    hashCode = HashCode.hash(seed, new short [] { 2,  4});
    System.out.println(hashCode);
  }

}
   

It gives the following output,
8949017
8765861


                    Print

   



Books Recommendation

 
 
bl  br