public static String generateChatId(final String receiverId,final String senderId){
  String combined=null;
  if (receiverId.compareTo(senderId) < 0) {
    combined=String.format(Locale.US,AppConstants.CHAT_ID_FORMAT,receiverId,senderId);
  }
 else {
    combined=String.format(Locale.US,AppConstants.CHAT_ID_FORMAT,senderId,receiverId);
  }
  String hashed=null;
  try {
    hashed=Utils.sha1(combined);
  }
 catch (  final NoSuchAlgorithmException e) {
    hashed=combined;
  }
  return hashed;
}

public static String generateChatId ( final String receiverId , final String senderId ) { String combined = null ; if ( receiverId . compareTo ( senderId ) < 0 ) { combined = String . format ( Locale . US , AppConstants . CHAT_ID_FORMAT , receiverId , senderId ) ; } else { combined = String . format ( Locale . US , AppConstants . CHAT_ID_FORMAT , senderId , receiverId ) ; } String hashed = null ; try { hashed = Utils . sha1 ( combined ) ; } catch ( final NoSuchAlgorithmException e ) { hashed = combined ; } return hashed ; }
generates as chat id which will be unique for a given sender / receiver pair
