I solved this issue myself actually. I downloaded the ashot.jar file first and added it to the project along with other Selenium JAR files
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import ru.yandex.qatools.ashot.AShot;
import ru.yandex.qatools.ashot.Screenshot;
import ru.yandex.qatools.ashot.shooting.ShootingStrategies;
import javax.imageio.ImageIO;
import java.io.File;
public class PageScreenShot
{
   public static void main(String args[]) throws Exception
   {
 System.setProperty("webdriver.gecko.driver","D:\\Selenium\\geckodriver.exe");
      WebDriver driver = new ChromeDriver();
    driver.get("https://www.edureka.co/");
    Thread.sleep(2000);
    Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);
  ImageIO.write(screenshot.getImage(),"PNG",new                              
File(System.getProperty("user.dir") +"/ErrorScreenshots/FullPageScreenshot.png"));
   }
}
It will scroll the page down to the very end and capture the screenshot. And we can control the scroll speed using the viewportPasting method. :)