package o; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Vector; import net.sf.scuba.smartcards.ISO7816; /* loaded from: classes6.dex */ public final class grR { private static String b; static { try { b = (String) AccessController.doPrivileged(new PrivilegedAction() { // from class: o.grR.4 @Override // java.security.PrivilegedAction public final /* synthetic */ String run() { return System.getProperty("line.separator"); } }); } catch (Exception unused) { try { b = String.format("%n", new Object[0]); } catch (Exception unused2) { b = "\n"; } } } public static String d(byte[] bArr) { char c; int i; byte b2; int i2 = 0; int i3 = 0; int i4 = 0; while (i3 < bArr.length) { byte b3 = bArr[i3]; if ((b3 & 240) == 240) { i4 += 2; i3 += 4; } else { i3 = (b3 & ISO7816.INS_CREATE_FILE) == 224 ? i3 + 3 : (b3 & ISO7816.INS_GET_RESPONSE) == 192 ? i3 + 2 : i3 + 1; i4++; } } char[] cArr = new char[i4]; int i5 = 0; while (i2 < bArr.length) { byte b4 = bArr[i2]; if ((b4 & 240) == 240) { int i6 = (((((b4 & 3) << 18) | ((bArr[i2 + 1] & 63) << 12)) | ((bArr[i2 + 2] & 63) << 6)) | (bArr[i2 + 3] & 63)) - 65536; char c2 = (char) ((i6 >> 10) | 55296); c = (char) ((i6 & 1023) | 56320); cArr[i5] = c2; i2 += 4; i5++; } else if ((b4 & ISO7816.INS_CREATE_FILE) == 224) { c = (char) (((b4 & 15) << 12) | ((bArr[i2 + 1] & 63) << 6) | (bArr[i2 + 2] & 63)); i2 += 3; } else { if ((b4 & ISO7816.INS_WRITE_BINARY) == 208) { i = (b4 & Ascii.US) << 6; b2 = bArr[i2 + 1]; } else if ((b4 & ISO7816.INS_GET_RESPONSE) == 192) { i = (b4 & Ascii.US) << 6; b2 = bArr[i2 + 1]; } else { c = (char) (b4 & UnsignedBytes.MAX_VALUE); i2++; } c = (char) (i | (b2 & 63)); i2 += 2; } cArr[i5] = c; i5++; } return new String(cArr); } public static String c(String str) { char[] charArray = str.toCharArray(); boolean z = false; for (int i = 0; i != charArray.length; i++) { char c = charArray[i]; if ('A' <= c && 'Z' >= c) { charArray[i] = (char) (c + ' '); z = true; } } return z ? new String(charArray) : str; } public static byte[] d(String str) { int length = str.length(); byte[] bArr = new byte[length]; for (int i = 0; i != length; i++) { bArr[i] = (byte) str.charAt(i); } return bArr; } public static String b(byte[] bArr) { return new String(e(bArr)); } private static char[] e(byte[] bArr) { int length = bArr.length; char[] cArr = new char[length]; for (int i = 0; i != length; i++) { cArr[i] = (char) (bArr[i] & UnsignedBytes.MAX_VALUE); } return cArr; } public static String[] a(String str) { int i; Vector vector = new Vector(); boolean z = true; while (true) { if (!z) { break; } int indexOf = str.indexOf(46); if (indexOf > 0) { vector.addElement(str.substring(0, indexOf)); str = str.substring(indexOf + 1); } else { vector.addElement(str); z = false; } } int size = vector.size(); String[] strArr = new String[size]; for (i = 0; i != size; i++) { strArr[i] = (String) vector.elementAt(i); } return strArr; } public static String b() { return b; } }