Java tutorial
//package com.java2s; import java.util.List; public class Main { public static final String VALID_DBHASH_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; public static final int SIZE_DBHASH = 10; /** * Generates a common hashname for joined * columns * @param hashes List of column hashes * @return common hash */ public static String createCommonName(List<String> hashes) { int[] nums = new int[SIZE_DBHASH]; char[] valids = VALID_DBHASH_CHARS.toCharArray(); StringBuilder sb = new StringBuilder(); for (String hash : hashes) { char[] cur = hash.toCharArray(); for (int i = 0; i < SIZE_DBHASH; i++) nums[i] += cur[i]; } for (int num : nums) sb.append(valids[num % valids.length]); return sb.toString(); } }