/** * Build the row key. * @param profile The name of the profile. * @param entity The name of the entity. * @param period The measure period * @param groups The groups. * @return The HBase row key. */ public byte[] rowKey(String profile, String entity, long period, List<Object> groups) { // row key = salt + prefix + group(s) + time byte[] salt = getSalt(period, saltDivisor); byte[] prefixKey = prefixKey(profile, entity); byte[] groupKey = groupKey(groups); byte[] timeKey = timeKey(period); int capacity = salt.length + prefixKey.length + groupKey.length + timeKey.length; return ByteBuffer .allocate(capacity) .put(salt) .put(prefixKey) .put(groupKey) .put(timeKey) .array(); }