From 4c315abb231562bd90ccd97c8db945dde9ee80c9 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 11 Aug 2013 01:09:19 +1200 Subject: Add array convertion method --- src/org/traccar/helper/ChannelBufferTools.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/org/traccar/helper/ChannelBufferTools.java b/src/org/traccar/helper/ChannelBufferTools.java index 4f1ebb7c0..c0df86bcd 100644 --- a/src/org/traccar/helper/ChannelBufferTools.java +++ b/src/org/traccar/helper/ChannelBufferTools.java @@ -97,4 +97,15 @@ public class ChannelBufferTools { return result.toString(); } + + /** + * Convert integer array to byte array + */ + public static byte[] convertArray(int[] in) { + byte[] out = new byte[in.length]; + for (int i = 0; i < in.length; i++) { + out[i] = (byte) in[i]; + } + return out; + } } -- cgit v1.2.3