How to get branch file size?

When I was solving the problem of getting the branch file size, I encountered a problem. When I used the following code to get the branch file size, the first request was different from the second request, and the second time was correct. ,I do not know how to solve this.

URL url = new URL(“http://git-scm01.ctyundao.cn/api/v4/projects/11555/repository/archive.zip?private_token=bmWLNZz6zWgBTLwa6iBS&sha=master”);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
int fileLength = urlConnection.getContentLength();
System.out.println(fileLength);