I'm new to the Java language and I've tried to write my first relatively complex program. After I wrote a few classes I've realized that I barely use built-in classes (like BigInteger, MessageDigest, ByteBuffer) directly because they don't totally fit my needs. Instead I write my own class and inside the class I use the built-in class as an attribute. Example:
public class SHA1 {
    public static final int SHA_DIGEST_LENGTH = 20;
    private MessageDigest md;
    public SHA1() {
        try {
            md = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
    }
    public void update(byte[] data) {
        md.update(data);
    }
    public void update(BigNumber bn) {
        md.update(bn.asByteArray());
    }
    public void update(String data) {
        md.update(data.getBytes());
    }
    public byte[] digest() {
        return md.digest();
    }
}
With the following simple class I don't have to use try catch when using SHA1, I can put my custom BigNumber class as parameter and I can also put String as parameter to update function.
The following BigNumber class contains all of the functions what I need and exactly how I need them.
public class BigNumber {
    private BigInteger m_bn;
    public BigNumber() {
        m_bn = new BigInteger("0");
    }
    public BigNumber(BigInteger bn) {
        m_bn = bn;
    }
    public BigNumber(String hex) {
        setHexStr(hex);
    }
    //reversed no minsize
    public byte[] asByteArray() {
        return asByteArray(0, true);
    }
    //reversed with minsize
    public byte[] asByteArray(int minSize) {
        return asByteArray(minSize, true);
    }
    public byte[] asByteArray(int minSize, boolean rev) {
        byte[] mag = m_bn.toByteArray();
        //delete sign bit
        //there is always a sign bit! so if bitNum % 8 is zero then
        //the sign bit created a new byte (0th)
        if(getNumBits() % 8 == 0) {
            byte[] tmp = new byte[mag.length-1];
            System.arraycopy(mag, 1, tmp, 0, mag.length-1);
            mag = tmp;
        }
        //extend the byte array if needed
        int byteSize = (minSize >= getNumBytes()) ? minSize : getNumBytes();
        byte[] tmp = new byte[byteSize]; 
        //if tmp's length smaller then byteSize then we keep 0x00-s from left
        System.arraycopy(mag, 0, tmp, byteSize-mag.length, mag.length);
        if(rev) ByteManip.reverse(tmp);
        return tmp;
    }
    public String asHexStr() {
        return ByteManip.byteArrayToHexStr(asByteArray(0, false));
    }
    public void setHexStr(String hex) {
        m_bn = new BigInteger(hex, 16);
    }
    public void setBinary(byte[] data) {
        //reverse = true
        ByteManip.reverse(data);
        //set as hex (binary set has some bug with the sign bit...)
        m_bn = new BigInteger(ByteManip.byteArrayToHexStr(data), 16);
    }
    public void setRand(int byteSize) {
        byte[] tmp = new byte[byteSize];
        new Random().nextBytes(tmp);
        //reversing byte order, but it doesn't really matter since it is a random
        //number
        setBinary(tmp);
    }
    public int getNumBytes() {
        return (m_bn.bitLength() % 8 == 0) ? (m_bn.bitLength() / 8) : (m_bn.bitLength() / 8 + 1);
    }
    public int getNumBits() {
        return m_bn.bitLength();
    }
    public boolean isZero() {
        return m_bn.equals(BigInteger.ZERO);
    }
    //operations
    public BigNumber modExp(BigNumber exp, BigNumber mod) {
        return new BigNumber(m_bn.modPow(exp.m_bn, mod.m_bn));
    }
    public BigNumber mod(BigNumber m) {
        return new BigNumber(m_bn.mod(m.m_bn));
    }
    public BigNumber add(BigNumber bn) {
        return new BigNumber(m_bn.add(bn.m_bn));
    }
    public BigNumber subtract(BigNumber bn) {
        return new BigNumber(m_bn.subtract(bn.m_bn));
    }
    public BigNumber multiply(BigNumber bn) {
        return new BigNumber(m_bn.multiply(bn.m_bn));
    }   
}
My question is that how common in Java language to use these kind of classes instead of the built-in classes? Does it make my code unreadable for other programmers (compared to implementing everything with built-in classes)?
I've read that new C++ programmers desperately trying to write codes they used to write in C therefore the benefits of C++ remains hidden for them. I'm afraid I do something like that in Java: trying to implement everything on my own instead of using the build-in classes directly. Is this happening (for example in the BigNumber class)?
Thank you for your opinions!
 
     
     
     
     
     
     
    