Java Hex Convert To fromHex(String str)

Here you can find the source of fromHex(String str)

Description

from Hex

License

Open Source License

Declaration

public static String fromHex(String str) 

Method Source Code

//package com.java2s;
/*// w w  w.  j ava  2s .  c o  m
 * JBoss, Home of Professional Open Source
 * Copyright 2011, Red Hat, Inc. and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser 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 software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

public class Main {
    public static String fromHex(String str) {
        StringBuffer buff = new StringBuffer();
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '\\') {
                buff.append(Integer.valueOf(str.substring(i + 4, i + 6), 16));
            } else {
                buff.append(str.charAt(i));
            }
        }
        //logger.debug(buff);
        return buff.toString();
    }
}

Related

  1. fromHex(String s)
  2. fromHex(String s)
  3. fromHex(String s)
  4. fromHex(String s, boolean hexIsDefault)
  5. fromHex(String src)
  6. fromHex(String str)
  7. fromHex(String string)
  8. fromHex(String text)
  9. fromHex(String[] data)