api – How can I specify the address from a private key?

From the steps in the wiki, take this example private key:

0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

When I import this to Electrum, I find these values:

Address:

1GAehh7TsJAHuUAeKZcXf5CnwuGuGgyX2S

Public Key:

04d0de0aaeaefad02b8bdc8a01a1b8b11c696bd3d66a2c5f10780d95b7df42645cd85228a6fb29940e858e7e55842ae2bd115d1ed7cc0e82d934e929c97648cb0a

How can I determine the direction from the key (without using Electrum)?

I understand that the source path is a private key -> public key -> address, so I’ve found a way to generate the public key in Java using BitcoinJ:

BigInteger privkey = new BigInteger("0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D", 16);
byte[] bytes = org.bitcoinj.core.ECKey.publicKeyFromPrivate(privkey, false);
String publickey = new BigInteger(1, bytes).toString(16);
while(publickey.length() < 130){
    publickey = "0" + publickey;
}
Log.d("public",publickey);

It gives the correct public key as shown above, so I need to find a way to get the address.

I don't know much about different address formats, but my goal is to use the address to check the balance using some public API like blockchain.com. I'm guessing this is the P2PKH-like reference.

I tried this:

NetworkParameters params = MainNetParams.get();
ECKey key = ECKey.fromPrivate(privkey);
String address = LegacyAddress.fromKey(params, key).toString();
Log.d("address",address);

Which gives me this address:

1LoVGDgRs9hTfTNJNuXKSpywcbdvwRXpmK

But the direction is different.

Source