I read the guide from stellar.org but still couldn't find a solution. This is the guide:
https://www.stellar.org/developers/guides/issuing-assets.html https://www.stellar.org/developers/guides/concepts/assets.html#revoking-access
In their guide it says that as an anchor, I can freeze credit held by another account. I set the AUTHORIZATION REVOCABLE to true, but I still couldn't find how to freeze a specific account credit.
This was the code in the stellar guide
import org.stellar.sdk.AccountFlag;
Network.useTestNetwork();
Server server = new Server("https://horizon-testnet.stellar.org");
// Keys for issuing account
KeyPair issuingKeys = KeyPair
.fromSecretSeed("SCZANGBA5YHTNYVVV4C3U252E2B6P6F5T3U6MM63WBSBZATAQI3EBTQ4");
AccountResponse sourceAccount = server.accounts().account(issuingKeys);
Transaction setAuthorization = new Transaction.Builder(sourceAccount)
.addOperation(new SetOptionsOperation.Builder()
.setSetFlags(
AccountFlag.AUTH_REQUIRED_FLAG.getValue() |
AccountFlag.AUTH_REVOCABLE_FLAG.getValue())
.build())
.build();
setAuthorization.sign(issuingKeys);
server.submitTransaction(setAuthorization);