Changing the algorithm when generating totp

In previous post, I showed with example how to generate an TOTP. I also mentioned in my previous post, how the framework by default using SHA-1 algorithm to generate the totp. In this post under OTP, I will show with example how to change the default algorithm. Below is the code for your reference. 1…… Continue reading Changing the algorithm when generating totp

assertArraysEquals example

In this post under Junit 5, I will explain with example the purpose of “assertArraysEquals” method. We can use the “assertArraysEquals” method to assert whether two arrays are equal or not. Below is the complete main code for your reference. Main Class package package15;import static org.junit.jupiter.api.Assertions.assertAll;import static org.junit.jupiter.api.Assertions.assertArrayEquals;import org.junit.jupiter.api.Test;public class Example15 { @Test public void…… Continue reading assertArraysEquals example

Creating text file of user specified size with random data

In this post under Java, I will show with example how to create a text file of user specified size with random data. Below is the complete code for you example Main class 1 package io;2 3 import java.io.BufferedWriter;4 import java.io.File;5 import java.io.FileWriter;6 import java.io.IOException;7 import java.util.Random;8 9 public class IOExample1 {10 private Random random;11…… Continue reading Creating text file of user specified size with random data