Similarity.java modified