Here you can find the source of formatSample(final int aValue, final long aTimestamp)
Parameter | Description |
---|---|
aValue | the sample value to format; |
aTimestamp | the timestamp to format. |
static String formatSample(final int aValue, final long aTimestamp)
//package com.java2s; /*//w w w .j a v a2 s. c o m * OpenBench LogicSniffer / SUMP project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program 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 * General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * * Copyright (C) 2006-2010 Michael Poppitz, www.sump.org * Copyright (C) 2010 J.W. Janssen, www.lxtreme.nl */ public class Main { /** * Formats the given value and timestamp into a single sample string. * * @param aValue * the sample value to format; * @param aTimestamp * the timestamp to format. * @return the sample string, in the form of * <value<sub>16</sub>>@<timestamp<sub>10</sub>>. */ static String formatSample(final int aValue, final long aTimestamp) { final String hexVal = Integer.toHexString(aValue & Integer.MAX_VALUE); final StringBuilder sb = new StringBuilder(); sb.append("00000000".substring(hexVal.length())); sb.append(hexVal); sb.append("@"); sb.append(Long.toString(aTimestamp & Long.MAX_VALUE)); return sb.toString(); } }