Check this Java Storage V12 change, there is a description about sas.
It was not discoverable how to do something as fundamental as create a SAS token because there was no generateSAS method, and figuring how to attach a SAS to a URL was yet another problem.
So for now if you want to use v12 sdk, have to say no way to implement it. If you accept other version sdk, you could refer to the below code, it uses a V8 sdk.
import com.microsoft.azure.storage.CloudStorageAccount;
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.blob.*;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import java.util.*;
public class App
{
public static void main( String[] args ) throws URISyntaxException, InvalidKeyException, StorageException {
String storageConnectionString ="connection string";
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
CloudBlobContainer container = blobClient.getContainerReference("test");
CloudBlockBlob blob = container.getBlockBlobReference("test.txt");
SharedAccessBlobPolicy sasPolicy = new SharedAccessBlobPolicy();
// Create a UTC Gregorian calendar value.
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
// Use the start time delta one hour as the end time for the shared
// access signature.
calendar.add(Calendar.HOUR, 10);
sasPolicy.setSharedAccessExpiryTime(calendar.getTime());
sasPolicy.setPermissions(EnumSet.of(SharedAccessBlobPermissions.READ, SharedAccessBlobPermissions.WRITE,
SharedAccessBlobPermissions.LIST));
String sas = blob.generateSharedAccessSignature(sasPolicy,null);
String sasurl=blob.getUri()+"?"+sas;
System.out.println(sasurl);
}
}

My dependency:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.4.0</version>
</dependency>
</dependencies>