Split string to array

ideally don't use the String class and stick to cString (null terminated char arrays)
there are C libraries you can use to do many things on those defined in stdlib.h and string.h.

Here is an example using strtok() and atol()

char msg[] = "1,20,300,4000,50000";

void setup()
{
  Serial.begin(115200);
  Serial.print(F("Parsing String: "));
  Serial.println(msg);
  char* ptr = strtok(msg, ",");
  byte i = 0;
  Serial.println(F("index\ttext\tNumeric Value"));
  while (ptr) {
    Serial.print(i);
    Serial.print(F("\t\""));
    Serial.print(ptr); // this is the ASCII text we want to transform into an integer
    Serial.print(F("\"\t"));
    Serial.println(atol(ptr)); // atol(ptr) will be your long int you could store in your array at position i. atol() info at http://www.cplusplus.com/reference/cstdlib/atol
    ptr = strtok(NULL, ",");
    i++;
  }
}

void loop() {}

You'll see in the console (set at 115200 bauds)

[color=purple]Parsing String: 1,20,300,4000,50000
index      text          Numeric Value
0          "1"           1
1          "20"          20
2          "300"         300
3          "4000"        4000
4          "50000"       50000
[/color]

PS: careful for the examples given above by other posters, the use of type uint8_t Ary[5];will limit number representation between 0 and 255. The parsing code does not detect any error and so if you have 1000 you'll overflow and won't get the right representation and if the number starts with a negative sign character it won't work either. If your array contains only small positive numbers fitting in a byte, then you are fine.

My code uses a library function to parse an long int, it can be positive or negative. Of course that code will fail if the input is not a number representation or does not fit in an unsigned long.