I have the following error in compiler
return ans;
^
required: byte[]
found: int[]
I have this method in which i want to return a type of byte . Can anyone tell me how can i cast ans to make it compatible with me method type
public byte[] element(int m) {
//if (q!= a.length)
// throw new Exception("Array length does not equal k");
int f;
int q;
int[] t;
this.first = f;
this.second = q;
this.data = new int[q];
for (int i = 0; i < t.length; ++i) {
this.data[i] = t[i];
}
// if (!this.IsValid())
// throw new Exception("Bad value from array");
int ans[] = new int[this.second];
int a = this.first;
int b = this.second;
int x = (choose(this.first,this.second) - 1) - m; // x is the "dual" of m
for (int i = 0; i < this.second; ++i) {
ans[i] = largestV(a, b, x); // largest value v, where v < a and vCb < x
x = x - choose(ans[i], b);
a = ans[i];
b = b - 1;
}
for (int i = 0; i < this.second; ++i) {
ans[i] = (first-1) - ans[i];
return ans;
}
}
Note: i want it to return type of byte not int but i am trying to cast ans but without success .