private void func(String mas) { int_mas.Clear(); if (mas[0] == ' ') { mas = mas.Remove(0, 1); } if (mas[mas.Length - 1] == ' ') { mas = mas.Remove(mas.Length - 1, 1); } String temp = ""; for (int i = 0; i < mas.Length; i++) { if (mas[i] == ' ') { int_mas.Add(int.Parse(temp)); temp = temp.Remove(0, temp.Length); } else { temp += mas[i]; if (i == mas.Length - 1) { int_mas.Add(int.Parse(temp)); temp = temp.Remove(0, temp.Length); } } } int_mas.Sort(); max = int_mas[int_mas.Count - 1]; min = int_mas[0]; remoteObj.adding_max(max); remoteObj.adding_min(min); }