code: @SuppressWarnings("deprecation")
  	public static long calculateNetworkBufferMemory(long totalJavaMemorySize, Configuration config) {
  		final int segmentSize = getPageSize(config);
  
  		final long networkBufBytes;
  		if (hasNewNetworkConfig(config)) {
  			float networkBufFraction = config.getFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION);
  			long networkBufSize = (long) (totalJavaMemorySize * networkBufFraction);
  			networkBufBytes = calculateNewNetworkBufferMemory(config, networkBufSize, totalJavaMemorySize);
  		} else {
  			// use old (deprecated) network buffers parameter
  			int numNetworkBuffers = config.getInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS);
  			networkBufBytes = (long) numNetworkBuffers * (long) segmentSize;
  
  			checkOldNetworkConfig(numNetworkBuffers);
  
  			ConfigurationParserUtils.checkConfigParameter(networkBufBytes < totalJavaMemorySize,
  				networkBufBytes, TaskManagerOptions.NETWORK_NUM_BUFFERS.key(),
  				"Network buffer memory size too large: " + networkBufBytes + " >= " +
  					totalJavaMemorySize + " (total JVM memory size)");
  		}
  
  		return networkBufBytes;
  	}
docs: Calculates the amount of memory used for network buffers based on the total memory to use and
  the according configuration parameters.
  
  <p>The following configuration parameters are involved:
  <ul>
  <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_FRACTION},</li>
  <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MIN},</li>
  <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MAX}, and</li>
  <li>{@link TaskManagerOptions#NETWORK_NUM_BUFFERS} (fallback if the ones above do not exist)</li>
  </ul>.
  
  @param totalJavaMemorySize overall available memory to use (in bytes)
  @param config configuration object
  
  @return memory to use for network buffers (in bytes)