Java Hex Calculate toHexFilter(String inAscii)

Here you can find the source of toHexFilter(String inAscii)

Description

to Hex Filter

License

Open Source License

Parameter

Parameter Description
inAscii String

Return

String

Declaration

public static String toHexFilter(String inAscii) 

Method Source Code

//package com.java2s;
/*/*  w w  w.  ja  va2  s  .co  m*/
This package is part of Relations application.
Copyright (C) 2010, Benno Luthiger
    
This library 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.1 of the License, or (at your option) any later version.
    
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
General Public License for more details.
    
You should have received a copy of the GNU General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

public class Main {
    /**
     * 
     * @param inAscii {@link String}
     * @return String
     */
    public static String toHexFilter(String inAscii) {
        StringBuilder out = new StringBuilder();

        char[] lChars = inAscii.toCharArray();
        for (int i = 0; i < lChars.length; i++) {
            out.append(Integer.toHexString((int) lChars[i]));
            if (i < (lChars.length - 1)) {
                out.append(" "); //$NON-NLS-1$
            }
        }
        return new String(out);
    }
}

Related

  1. toHexDigits(int value)
  2. toHexDump(byte[] ab, int cBytesPerLine)
  3. toHexDump(byte[] buffer, int offset, int length, boolean hex, boolean ascii)
  4. toHexDump(byte[] bytes)
  5. toHexEscape(final int u0)
  6. toHexFromBin(final String binSymbols)
  7. toHexFromByte(byte b)
  8. toHexFromByte(final byte b)
  9. toHexFromBytes(byte[] bytes)