Here you can find the source of convertStringToPrimaryKey(String keyString)
Converts a String
to the 192-bit primary key.
Parameter | Description |
---|---|
keyString | the key string to convert. |
public static byte[] convertStringToPrimaryKey(String keyString)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www. j a v a2 s .c o m*/ * <p>Converts a <code>String</code> to the 192-bit primary key.</p> * Converts the given key to lower case prior to conversion to binary. * * @param keyString the key string to convert. * * @return a 192-bit primary key. */ public static byte[] convertStringToPrimaryKey(String keyString) { if ((keyString != null) && (!"".equals(keyString))) { keyString = keyString.toLowerCase(); byte[] bArray = new byte[(keyString.length() / 2)]; for (int i = 0; i < bArray.length; i++) { bArray[i] = (byte) Integer.parseInt(keyString.substring(i * 2, i * 2 + 2), 16); } return bArray; } return null; } }