preheat the oven to 400 f and line a large rimmed baking tray with foil. spread the corn out evenly and place the tray in the oven for 15 minutes. after 15 minutes of cooking, take out the tray and stir to mix it up for more evenly roasted kernels. place back in the oven for another 15 to 25 minutes.