package a.c.a.b;

import java.nio.charset.StandardCharsets;
import java.util.Locale;

public class d {

    /* renamed from: a  reason: collision with root package name */
    private static final String f60a = "\\.";
    private static final int b = 2;
    private static final int c = 12;
    private static final int d = 8;
    private static final int e = 16;
    private static final int f = 12;
    private static final int g = 4;

    private static String a(String str) {
        if (str == null) {
            return "";
        }
        byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
        if (bytes.length <= 16) {
            return str;
        }
        while (bytes.length > 16 && !str.isEmpty()) {
            str = str.substring(0, str.length() - 1);
            bytes = (str + "…").getBytes(StandardCharsets.UTF_8);
        }
        return new String(bytes, StandardCharsets.UTF_8);
    }

    private static String a(String str, int i) {
        return str == null ? "" : str.length() > i ? str.substring(0, i) : str;
    }

    public static String a(String str, String str2, String str3, String str4, String str5, String str6) {
        return String.format("%s;%s;%s;%s;%s;%s", a(str, 12), a(str2, 8), a(str3), a(str4, 12), b(str5), a(str6, 4));
    }

    private static String b(String str) {
        if (str == null) {
            return "";
        }
        String[] split = str.split(f60a);
        if (split.length >= 2) {
            byte[] bArr = new byte[2];
            for (int i = 0; i < 2; i++) {
                bArr[i] = (byte) Integer.parseInt(split[i]);
            }
            return String.format(Locale.ENGLISH, "%d.%d", Integer.valueOf(Byte.toUnsignedInt(bArr[0])), Integer.valueOf(Byte.toUnsignedInt(bArr[1])));
        }
        throw new IllegalArgumentException();
    }
}
