How to exclude elements from int[]

I’m using Mathf.Min within int variable.

Is there a way to find minimum, but more than 0?

And second question:
How to exclude all elements that are “0” from my array (or whatever it’s called when using int).

I found some statements like removeAt or push, but those don’t work with int.

Thank you.

Arrays are bit tricky. Any particular reason why are you using integer array, instead of Integer Lists?

If you create,

List<int> myList = new List<int>();

then you can do:
myList.Minimum, Sort, Reverse, RemoveAt, InsertAt, and tons of other cool functions.

If you insist on using int array, then you just gotta do it all by hand.

First use one For loop to count all zeroes in your array.
Create another int array that is the size of original array minus zero counts.

Second for loop that copies over original array to new array, except when element is zero.

int[] original = //assumed
int[] newArray;

int zeroCounter;
int minimumInArray = int.maxValue;

for(int i = 0; i<original.Length; i++)
	if (original _> 0 && original *< minimumInArray)*_

_ minimumInArray = original*;*_

_ if (original == 0)
* zeroCounter++;

newArray = new int[original.Length - zeroCounter];

int index = 0;
for(int i = 0; i<original.Length; i++)
_ if (original != 0)
newArray[index++] = original*;

//At this point:
//minimumInArray contains the lowest value from original array that is not zero
//newArray contains all values from original except zero elements.