Given an array of numbers, I would like to create a numerical identifier that represents this combination as unique as possible.
For instance:
int[] inputNumbers = { 543, 134, 998 }; int identifier = createIdentifier(inputNumbers); System.out.println( identifier );
Output:
4532464234
- The returned number should be as unique as possible
-Detection of elements should influence the result.
- The algorithm should always return the same result from a single input array
- The algorithm should be used as quickly as possible for use in 'for' loops
The purpose of this algorithm is to create a small value that will be stored in the database and be easily comparable. Nothing is critical, so it is acceptable that some arrays of numbers return the same value, but these cases should be rare.
Can you suggest a good way to do this?
source share