'How do I make a method like int.getRed() in java?

I am making an imaginary number graphing calculator with java (using a+bi={a,b}) and want to make new functions for + - * / and ^ operators, since they don't work on double[] variables. I know how to make normal methods, like File(), but I am having trouble doing things like int.getRed(). Here's my code for the addition method

private static double[] CPlusC(double[] a, double[] b) {
    double aN = a[1] + b[1];
    double bN = a[2] + b[2];
    double[] ansN = {aN,bN};
    return ansN;
}

I have the addition parts correct, I just can't find anything to make the function more "realistic", as in double[].CPlusC(double[]) Could someone please help me out? Once I figure this one out, I should know how to do the others. Thank you so much!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source