class BtcTransactionFormatUtils {

    public static long getInputsCountForSegwit(byte[] btcTxSerialized) {
        VarInt inputsCounter = new VarInt(btcTxSerialized, 4);

        if (inputsCounter.value != 0) {
            return -1;
        }

        inputsCounter = new VarInt(btcTxSerialized, 5);

        if (inputsCounter.value != 1) {
            return -1;
        }

        inputsCounter = new VarInt(btcTxSerialized, 6);
        return inputsCounter.value;
    }

}