Back to project page BLEService.
The source code is released under:
Copyright (c) 2014, Ratio LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project BLEService listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ratio.util; /*from w w w .j a v a2s. co m*/ import java.util.ArrayList; import java.util.List; import android.database.DatabaseUtils; // grab-bag of string utilities. public class StringUtil { // generate the string with some nice deadbeef hex code for binary data public static String toHexCode(byte[] data) { final StringBuilder stringBuilder = new StringBuilder(data.length*2); for(byte byteChar : data) { stringBuilder.append(String.format("%02X", byteChar)); } return stringBuilder.toString(); } public static String toHexCode(byte[] data, int offset, int length) { final StringBuilder stringBuilder = new StringBuilder(data.length*2); for (int i = offset; i < offset + length; i++) { byte byteChar = data[i]; stringBuilder.append(String.format("%02X", byteChar)); } return stringBuilder.toString(); } }