Back to project page android-weather-station.
The source code is released under:
Apache License
If you think the Android project android-weather-station 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 de.grundid.weather.utils; //from w w w. j a va2s . com public class Utils { private static final char[] hexArray = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; public static String bufferToString(byte[] buffer) { return bufferToString(buffer, buffer.length); } public static String bufferToString(byte[] buffer, int length) { StringBuffer sb = new StringBuffer(); char[] hexChars = new char[length * 2]; int v; for (int j = 0; j < length; j++) { v = buffer[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } sb.append(hexChars); return sb.toString(); } }