Is there a way to set the default values of an array upon construction? I'm initialising a character array like so,
char[] chars = new char[value];
However, the default value for each element is decimal 0
, rather than decimal 48
which is the ASCII character for '0'
.
The closest thing I've found is calling:
Arrays.fill(chars, '0');
which fills the array with the desired decimal value 48
But this is called after the array has already been created full of 0
values which presumably takes more time?