CodecSpecificDataUtil { public static Pair<Integer, Integer> parseAlacAudioSpecificConfig(byte[] audioSpecificConfig) { ParsableByteArray byteArray = new ParsableByteArray(audioSpecificConfig); byteArray.setPosition(9); int channelCount = byteArray.readUnsignedByte(); byteArray.setPosition(20); int sampleRate = byteArray.readUnsignedIntToInt(); return Pair.create(sampleRate, channelCount); } private  CodecSpecificDataUtil(); static Pair<Integer, Integer> parseAacAudioSpecificConfig(byte[] audioSpecificConfig); static Pair<Integer, Integer> parseAacAudioSpecificConfig(
      ParsableBitArray bitArray, boolean forceReadToEnd); static byte[] buildAacLcAudioSpecificConfig(int sampleRate, int channelCount); static byte[] buildAacAudioSpecificConfig(int audioObjectType, int sampleRateIndex,
      int channelConfig); static Pair<Integer, Integer> parseAlacAudioSpecificConfig(byte[] audioSpecificConfig); static String buildAvcCodecString(
      int profileIdc, int constraintsFlagsAndReservedZero2Bits, int levelIdc); static byte[] buildNalUnit(byte[] data, int offset, int length); static @Nullable byte[][] splitNalUnits(byte[] data);  }
@Test public void parseAlacAudioSpecificConfig() { byte[] alacSpecificConfig = new byte[] { 0, 0, 16, 0, 0, 16, 40, 10, 14, 2, 0, 0, 0, 0, 64, 4, 0, 46, -32, 0, 0, 1, 119, 0, }; Pair<Integer, Integer> sampleRateAndChannelCount = CodecSpecificDataUtil.parseAlacAudioSpecificConfig(alacSpecificConfig); assertThat(sampleRateAndChannelCount.first).isEqualTo(96000); assertThat(sampleRateAndChannelCount.second).isEqualTo(2); }