How can I determine the address from a private key? From the steps in the wiki, take this example private key:
0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D

When I import this into Electrum, I find these values:
Address:
1GAehh7TsJAHuUAeKZcXf5CnwuGuGgyX2S

Public Key:
04d0de0aaeaefad02b8bdc8a01a1b8b11c696bd3d66a2c5f10780d95b7df42645cd85228a6fb29940e858e7e55842ae2bd115d1ed7cc0e82d934e929c97648cb0a

How can I determine the address from the key (without using Electrum)?
I understand that the derivation route is private key -&gt; public key -&gt; address, so I've found a way to generate the public key in Java using BitcoinJ:
BigInteger privkey = new BigInteger(&quot;0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D&quot;, 16);
byte[] bytes = org.bitcoinj.core.ECKey.publicKeyFromPrivate(privkey, false);
String publickey = new BigInteger(1, bytes).toString(16);
while(publickey.length() &lt; 130){
    publickey = &quot;0&quot; + publickey;
}
Log.d(&quot;public&quot;,publickey);

It gives the correct public key as shown above, so I just 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 guess this is the P2PKH-type address.
I tried this:
NetworkParameters params = MainNetParams.get();
ECKey key = ECKey.fromPrivate(privkey);
String address = LegacyAddress.fromKey(params, key).toString();
Log.d(&quot;address&quot;,address);

Which gives me this address:
1LoVGDgRs9hTfTNJNuXKSpywcbdvwRXpmK

But the address is different.
Both &quot;1LoVG..&quot; and the other one are valid legacy (1...) addresses made using the same private key. They are different since one of them uses the compressed public key (you might want to look this up) while 1GAehh7 uses the uncompressed public key. Always use the same compress-format for an address, and it's advisable to create new addresses in compressed format since it saves bytes and transaction fees.
To make the uncompressed-public-keyed address (compressed is the default in BitcoinJ):
ECKey key = ECKey.fromPrivate(privkey);
key = key.decompress();
String address = LegacyAddress.fromKey(params, key).toString();