package cc.smtweb.system.bpm.test;

import org.apache.commons.codec.binary.Hex;
import org.junit.jupiter.api.Test;

import java.io.FileInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;

public class HexTest {

  @Test
  public void hexToText() throws Exception {

    FileInputStream fis = new FileInputStream("/var/1.txt");

    byte[] data = new byte[2 * 1024 * 1024];
    int len = fis.read(data);

    byte[] buf = Hex.decodeHex(new String(data, 0, len));

    System.out.println(new String(buf, StandardCharsets.UTF_8));
  }

  @Test
  public void joinTest() {
    Set<String> ids = new HashSet<>();
    ids.add("1");
    ids.add("2");
    ids.add("3");
    ids.add("1");

    System.out.println(String.join(",", ids));
  }
}
