question: public static String encryptCFB ( final byte [ ] concatenatedHashValue , final Long turnoverCounter , final SecretKey symmetricKey , int turnOverCounterLengthInBytes ) throws NoSuchAlgorithmException , NoSuchProviderException , NoSuchPaddingException , InvalidKeyException , InvalidAlgorithmParameterException , IllegalBlockSizeException , BadPaddingException { final ByteBuffer byteBufferIV = ByteBuffer . allocate ( 16 ) ; byteBufferIV . put ( concatenatedHashValue ) ; final byte [ ] IV = byteBufferIV . array ( ) ; final ByteBuffer byteBufferData = ByteBuffer . allocate ( 16 ) ; byteBufferData . putLong ( turnoverCounter ) ; final byte [ ] data = byteBufferData . array ( ) ; byte [ ] turnOverCounterByteRep = get2ComplementRepForLong ( turnoverCounter , turnOverCounterLengthInBytes ) ; System . arraycopy ( turnOverCounterByteRep , 0 , data , 0 , turnOverCounterByteRep . length ) ; final IvParameterSpec ivSpec = new IvParameterSpec ( IV ) ; final Cipher cipher = Cipher . getInstance ( "AES/CFB/NoPadding" , "BC" ) ; cipher . init ( Cipher . ENCRYPT_MODE , symmetricKey , ivSpec ) ; final byte [ ] encryptedTurnOverValueComplete = cipher . doFinal ( data ) ; final byte [ ] encryptedTurnOverValue = new byte [ turnOverCounterLengthInBytes ] ; System . arraycopy ( encryptedTurnOverValueComplete , 0 , encryptedTurnOverValue , 0 , turnOverCounterLengthInBytes ) ; final String base64EncryptedTurnOverValue = CashBoxUtils . base64Encode ( encryptedTurnOverValue , false ) ; return base64EncryptedTurnOverValue ; }
target:  method for AES encryption in CFB mode (for the first block CFB and CTR are exactly the same