public class Key extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ID_LENGTH |
| Constructor and Description |
|---|
Key(BigInteger key) |
Key(byte[] result) |
Key(int id) |
| Modifier and Type | Method and Description |
|---|---|
static Key |
build(String key) |
Key |
generateNodeIdByDistance(int distance)
Generates a Key that is some distance away from this Key
|
int |
getDistance(Key to)
Gets the distance from this Key to another Key
|
int |
getFirstSetBitIndex()
Counts the number of leading 0's in this Key
|
static Key |
random() |
String |
toString() |
Key |
xor(Key nid)
Checks the distance between this and another Key
|
public static final int ID_LENGTH
public Key(byte[] result)
public Key(BigInteger key)
public Key(int id)
public static Key random()
public Key xor(Key nid)
nid - public Key generateNodeIdByDistance(int distance)
distance - in number of bitspublic int getFirstSetBitIndex()
public int getDistance(Key to)
to - Copyright © 2016. All Rights Reserved.