/**
  * Transforms {@link PtuFlexOfferDto} to a {@link PTU}.
  *
  * @param ptuFlexOfferDto
  * @return
  */
 public static PTU transformToPTU(PtuFlexOfferDto ptuFlexOfferDto) {
   if (ptuFlexOfferDto == null) {
     return null;
   }
   PTU ptu = new PTU();
   ptu.setStart(ptuFlexOfferDto.getPtuIndex());
   ptu.setPower(ptuFlexOfferDto.getPower());
   ptu.setPrice(ptuFlexOfferDto.getPrice());
   return ptu;
 }
 private void max100PercentOfOriginalPower(
     PtuFlexRequestDto ptuFlexRequestDto, PtuFlexOfferDto ptuFlexOfferDto) {
   BigDecimal percentage = BigDecimal.valueOf(Math.abs(new Random().nextDouble() % 1));
   // Offer up to 0% of the requested power and max 100%
   ptuFlexOfferDto.setPower(
       percentage
           .multiply(new BigDecimal(ptuFlexRequestDto.getPower()), MathContext.DECIMAL64)
           .toBigInteger());
   ptuFlexOfferDto.setPrice(
       BigDecimal.valueOf(0.4)
           .multiply(new BigDecimal(ptuFlexOfferDto.getPower()), MathContext.DECIMAL64));
 }