Here you can find the source of bytes2unique(byte[] daten, int offset)
static String bytes2unique(byte[] daten, int offset)
//package com.java2s; /* ============================================================= * SmallSQL : a free Java DBMS library for the Java(tm) platform * ============================================================= * * (C) Copyright 2004-2007, by Volker Berlin. * * Project Info: http://www.smallsql.de/ * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version.//from ww w .ja va 2 s. c o m * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * --------------- * Utils.java * --------------- * Author: Volker Berlin * */ public class Main { final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; static String bytes2unique(byte[] daten, int offset) { if (daten.length - offset < 16) { byte[] temp = new byte[16]; System.arraycopy(daten, offset, temp, 0, daten.length - offset); daten = temp; } char[] chars = new char[36]; chars[8] = chars[13] = chars[18] = chars[23] = '-'; chars[0] = digits[(daten[offset + 3] >> 4) & 0x0F]; chars[1] = digits[(daten[offset + 3]) & 0x0F]; chars[2] = digits[(daten[offset + 2] >> 4) & 0x0F]; chars[3] = digits[(daten[offset + 2]) & 0x0F]; chars[4] = digits[(daten[offset + 1] >> 4) & 0x0F]; chars[5] = digits[(daten[offset + 1]) & 0x0F]; chars[6] = digits[(daten[offset + 0] >> 4) & 0x0F]; chars[7] = digits[(daten[offset + 0]) & 0x0F]; chars[9] = digits[(daten[offset + 5] >> 4) & 0x0F]; chars[10] = digits[(daten[offset + 5]) & 0x0F]; chars[11] = digits[(daten[offset + 4] >> 4) & 0x0F]; chars[12] = digits[(daten[offset + 4]) & 0x0F]; chars[14] = digits[(daten[offset + 7] >> 4) & 0x0F]; chars[15] = digits[(daten[offset + 7]) & 0x0F]; chars[16] = digits[(daten[offset + 6] >> 4) & 0x0F]; chars[17] = digits[(daten[offset + 6]) & 0x0F]; chars[19] = digits[(daten[offset + 8] >> 4) & 0x0F]; chars[20] = digits[(daten[offset + 8]) & 0x0F]; chars[21] = digits[(daten[offset + 9] >> 4) & 0x0F]; chars[22] = digits[(daten[offset + 9]) & 0x0F]; chars[24] = digits[(daten[offset + 10] >> 4) & 0x0F]; chars[25] = digits[(daten[offset + 10]) & 0x0F]; chars[26] = digits[(daten[offset + 11] >> 4) & 0x0F]; chars[27] = digits[(daten[offset + 11]) & 0x0F]; chars[28] = digits[(daten[offset + 12] >> 4) & 0x0F]; chars[29] = digits[(daten[offset + 12]) & 0x0F]; chars[30] = digits[(daten[offset + 13] >> 4) & 0x0F]; chars[31] = digits[(daten[offset + 13]) & 0x0F]; chars[32] = digits[(daten[offset + 14] >> 4) & 0x0F]; chars[33] = digits[(daten[offset + 14]) & 0x0F]; chars[34] = digits[(daten[offset + 15] >> 4) & 0x0F]; chars[35] = digits[(daten[offset + 15]) & 0x0F]; return new String(chars); } }