title: Forming a base64 strings of equal length for any given size file
body: <p>Actually, I require </p>
  
  <blockquote>
    <p>A valid Base64 string value that identifies the block. Prior to
    encoding, the string must be less than or equal to 64 bytes in size.</p>
    
    <p>For a given blob, the length of the value specified for the blockid
    parameter must be the same size for each block.</p>
    
    <p>Note that the Base64 string must be URL-encoded.</p>
  </blockquote>
  
  <p>as stated in <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-block" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/put-block</a>.</p>
  
  <p>For that, I am converting some C# code to Java. And I am having problem with this line of code </p>
  
  <pre><code>//create a blockID from the block number, add it to the block ID list
                        //the block ID is a base64 string
  String blockId = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(string.Format("BlockId{0}",blockNumber.ToString("0000000"))));
  </code></pre>
  
  <p>I have tried below:</p>
  
  <pre><code>String str = "BlockId"+blockNumber;
  String blockId = Base64.getEncoder().encodeToString(("BlockId"+(blockNumber+"")).getBytes("utf-8"));
  </code></pre>
  
  <p>But, I am not able to understand what "0000000" as a argument to ToString doing and what is its equivalent in Java.</p>
  
  <p>And also how can I fulfil the second condition that length of blockid of each block or chance file should be same in JAVA. As file size can vary.</p>