Extracting OpenJDK 1.8 and 17, Setting Environment Variables, and Verifying Java Versions in Dockerfile

I have following tar files ( existing) in my docker file:

RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/OpenJDK11U-jdk_x64_linux_hotspot_11.0.15_10.tar.gz -P /AzDOAgents
RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/OpenJDK11U-jdk_x64_linux_hotspot-11.0.6_10.tar.gz -P /AzDOAgents
RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz -P /AzDOAgents
RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/openjdk-21.0.2_linux-x64_bin.tar.gz -P /AzDOAgents
RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/openlogic-openjdk-8u292-b10-linux-x64.tar.gz -P /AzDOAgents
RUN wget --http-user=$AUSER --http-password=$APASS /OpenJDK/Linux/openlogic-openjdk-8u432-b06-linux-x64.tar.gz -P /AzDOAgents

Could you please clarify my following doubts:

Question1:

I want to extract 1.8 and 17 versions and set env, to achive this, I am planning to use so my below commands, is it correct?

Extract the tar.gz files

RUN tar -xzf /AzDOAgents/openlogic-openjdk-8u292-b10-linux-x64.tar.gz -C /AzDOAgents
RUN tar -xzf /AzDOAgents/openlogic-openjdk-8u432-b06-linux-x64.tar.gz -C /AzDOAgents
RUN tar -xzf /AzDOAgents/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz -C /AzDOAgents

Set environment variables for Java 1.8 and Java 17

ENV JAVA_HOME_8=/AzDOAgents/openlogic-openjdk-8u292-b10-linux-x64
ENV JAVA_HOME_17=/AzDOAgents/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8
ENV PATH=$JAVA_HOME_8/bin:$JAVA_HOME_17/bin:$PATH

Question2:
I want to check image size before and after and also java version, can you please give me precise command for that?

Question 3:

Where to add these commands exactly in the Dockerfile , is it after existing lines?